Xcode 4.5 UIScrollView [英] Xcode 4.5 UIScrollView
问题描述
我想在我的项目中添加一个scrollview。
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)];
}
这适用于xcode 4.3和IOS 5.但是知道它没有滚动。
This works good with xcode 4.3 und IOS 5. But know it doesn't scroll.
如果我在文件检查器中停用自动布局
,它将完美无缺。
但是具有较小显示屏的iPhone 4的布局不正确。 iPhone 5中的布局看起来不错。
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
?
推荐答案
将此约束移动到viewDidAppear。我刚刚在另一个问题上解释了这个问题( Autolayout Question )。
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)];
....
}
这篇关于Xcode 4.5 UIScrollView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!