开发者

UIScrollView problems with View created in IB

I have a ViewController with a UIScrollView and in that a UIView that has about 25 UITextFields, this UIView is definitely larger than the UIScrollView containing it. When I launch the app no scrolling happens, totally frustrating. I have look at several similar ques开发者_如何转开发tions and I have set this in my viewdidload:

[scrollView setContentSize:CGSizeMake(2000, 2000)];

This seems like it should be so simple and I cannot figure it out, anyone?


Regardless of the subviews contained within it, a scrollview will scroll over only its contentSize. The contentSize is not set automatically by Interface Builder, so you have to set it in code. All subviews will be adjusted by the scrollview's current offset into its contentSize area, effecting scrolling.

To set contentSize programmatically, you need an outlet to your scrollview. Use the normal Xcode/Interface Builder mechanisms for that (ie, declare one in Xcode, wire it up in Interface Builder).

Does that explain everything?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜