UIScrollView 底部的 UIButtons 不起作用

UIButtons at the bottom of UIScrollView not working(UIScrollView 底部的 UIButtons 不起作用)
本文介绍了UIScrollView 底部的 UIButtons 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我在我的故事板中创建了一个 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 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

scrollViewWillEndDragging:withVelocity:targetContentOffset: not working on the edges of a UISCrollView(scrollViewWillEndDragging:withVelocity:targetContentOffset: 不在 UISCrollView 的边缘工作)
ImageView Scaling when scrolling down(向下滚动时 ImageView 缩放)
Bounds automatically changes on UIScrollView with content insets(UIScrollView 上的边界自动更改,带有内容插图)
iOS5 UITapRecognizer for UIScrollView interfering with buttons. How to fix?(用于 UIScrollView 的 iOS5 UITapRecognizer 干扰按钮.怎么修?)
Handling scroll views with (custom, interactive) view controller presentation and dismissal(使用(自定义、交互式)视图控制器呈现和解除处理滚动视图)
How to Cancel Scrolling in UIScrollView(如何在 UIScrollView 中取消滚动)