在 IB 中,我有我的 UIView.然后我有一个带有 UIScrollView 作为子视图的子 UIView.然后 UIScrollView 有一个子 UIImageView.UIScrollView 和 UIImageView 的大小相同.它们比作为子视图的 UIView 大得多.我认为这会使滚动工作.它没有.滚动视图是否需要某种代码才能工作?
In IB I have my UIView. Then I have a sub-UIView with a UIScrollView as a sub view. Then the UIScrollView has a sub-UIImageView. The UIScrollView and UIImageView are the same size. They're much bigger than the UIView of which they are subviews. I assumed this would make scrolling work. It doesn't. Is some sort of code required for scroll views to work?
您需要设置 UIScrollView.contentSize 以匹配总的可滚动大小,在这种情况下是您的子视图框架大小.
You need to set UIScrollView.contentSize to match the total scrollable size, which is your subview frame size in this case.
这篇关于UIScrollView 不会滚动!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
UIScrollView 底部的 UIButtons 不起作用UIButtons at the bottom of UIScrollView not working(UIScrollView 底部的 UIButtons 不起作用)
如何在 UIScrollView 中取消滚动How to Cancel Scrolling in UIScrollView(如何在 UIScrollView 中取消滚动)
如何在 UITableView 下方添加活动指示器?How can i add a activity indicator below the UITableView?(如何在 UITableView 下方添加活动指示器?)
如何使用 UIScrollView 创建顶部淡入淡出效果?How to create a top fade effect using UIScrollView?(如何使用 UIScrollView 创建顶部淡入淡出效果?)
是否可以将固定内容添加到 UIScrollView?Is it possible to add fixed content to a UIScrollView?(是否可以将固定内容添加到 UIScrollView?)
UIScrollView 不显示滚动指示器UIScrollView not showing scroll indicator(UIScrollView 不显示滚动指示器)