Xcode 4.5 UIScrollView

陌路散爱 提交于 2019-12-11 06:22:45

问题


I'd like to add a scrollview to my project.

I've added the following code in my file:

- (void)viewDidLoad
{
    [super viewDidLoad];

    [scrollView setScrollEnabled:YES];
    [scrollView setContentSize: CGSizeMake(320, 830)];
}

This works good with xcode 4.3 und IOS 5. But know it doesn't scroll.

If I deactivate Auto Layout in the file inspector it works perfect. But the layout in for iPhone 4 with the smaller display is not correct. The layout in iPhone 5 looks good.

What should I do, when I want don't to enable Auto Layout?


回答1:


Move this constrains to viewDidAppear. I just explained this issue on another question (Autolayout Question).

- (void)viewDidAppear
{
.....
[scrollView setScrollEnabled:YES];
[scrollView setContentSize: CGSizeMake(320, 830)];
....
}


来源:https://stackoverflow.com/questions/12747603/xcode-4-5-uiscrollview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!