问题描述
我在我的故事板中创建了一个 UIScrollView,并在 UIScrollView 内的容器视图中添加了 12 个 UIButton.
I created a UIScrollView in my storyboards and have added 12 UIButtons in a container View which is inside the UIScrollView.
在 iPhone 5s 模拟器上运行时,屏幕上可以看到 9 个按钮,其余按钮只有向下滚动才能看到.
when running on the iPhone 5s simulator, 9 of the buttons can be seen on the screen, the rest of the buttons only can be seen when you scroll down.
最初可以在屏幕上看到的 9 个按钮可以与之交互.但是,滚动视图底部的 3 个按钮(必须滚动到才能看到)无法交互.
the 9 buttons that can be initially seen on the screen can be interacted with. However the 3 buttons at the bottom of the scroll view (which have to be scrolled to in order to be seen) cannot be interacted with.
我在 iPhone 6 模拟器上运行该应用程序,该模拟器无需滚动即可在屏幕上显示所有 12 个按钮,并且底部 3 个按钮可以工作.
I ran the app on an iPhone 6 simulator which displays all 12 of the buttons on the screen without having to scroll and the bottom 3 buttons work.
我正在使用自动布局.
我曾尝试摆弄 UIScrollView 的 contentSize,但它没有帮助.
I have tried fiddling with the contentSize of the UIScrollView and it does not help.
推荐答案
看来你需要增加容器视图的框架高度.scrollView 的 contentSize
只影响它的滚动方式,这里无关紧要.
It seems you need to increase the frame height of container view. The contentSize
of scrollView only affects how it will scroll, which is irrelevant here.
如果按钮在容器视图之外,它仍然会显示.但是,它无法响应任何触摸事件.
If the button is outside the container view, it will still show up. However, it can't respond to any touch event.
这篇关于UIScrollView 底部的 UIButtons 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!