iOS 6中的UIScrollView [英] UIScrollView in iOS 6
问题描述
最近我已经下载了Xcode 4.5(iOS 6),但是当我尝试继续我的一个项目时,我注意到UIScrollView无法正常工作,让我更清楚地解释一下:
Recently i've downloaded Xcode 4.5(iOS 6),but when tried to continue one of my projects i noticed that the UIScrollView isn't working properly,let me explain more clearly:
我创建了UIScrollView并使用以下代码添加了初始化它:
I've created the UIScrollView and added the initialized it using the following code:
-(void)viewDidLoad{
[mainScrollView setScrollEnabled:YES];
mainScrollView.contentSize = CGSizeMake(480, 0);
[super viewDidLoad];
}
在我打开我的XIB并链接<$ c $之后c> mainScrollView 到UIScrollView后,我将一些UIButton添加到scrollView。当我构建项目时, mainScrollView
滚动但按钮没有' t出现了,我的意思是,我只能看到屏幕上已有的按钮。我做错了什么?我如何设置UIScrollView?
After i opened my XIB and linked the mainScrollView
to a UIScrollView,after i added some UIButton's to the scrollView.When i built the project the mainScrollView
was scrolling but the buttons didn't showed up,i mean,i just could see the button that were already on the screen.What i'm doing wrong?How can i setup the UIScrollView?
推荐答案
对于 xcode 4.5
,如果你使用 scrollView
你必须在文件检查器中取消选中使用AutoLayout
。
For xcode 4.5
,If you are using scrollView
you have to either uncheck "use AutoLayout
" in file inspector.
或者如果你想使用 AutoLayout
,然后在 .m(实施)文件中添加此
or if you want to "use AutoLayout
",then in .m(implementation) file add this
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
theScroller.contentSize=CGSizeMake(1024.0,1300.0);
}
这篇关于iOS 6中的UIScrollView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!