UIScrollView won#39;t scroll!(UIScrollView 不会滚动!)
问题描述
在 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 不会滚动!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:UIScrollView 不会滚动!
基础教程推荐
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
