开发者

UIScrollView not working in IB

I have a UIScrollView that contains a UI开发者_JAVA百科View inside.

The UIScrollView has paging enabled and is 320x500

The UIView is 320x480

My UIView doesn't scroll in the simulator or on the device. What am I doing wrong?


To make the UIScrollView scroll, the ScrollView.contentSize should be larger than the ScrollView.frame.size
If you want it to scroll only up-down, make the ScrollView.contentSize.height greater than the ScrollView.frame.size.height (and so on for scrolling sideways or both ways)
You'll have to set the content size programmatically.


You probably didn't set the contentSize property of the UIScrollView, which is a CGSize. Set this property with the content view frame's size.

Also your UIView isn't larger than the scroll view, but it should at least bounce the scroll.


Make sure you have an object to be the UIScrollView's delegate, and that it implements the required methods for panning. Read more about it here:

UIScrollView documentation

Hope that helped!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜