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 不会滚动!


- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01