自动布局打开时的 UIScrollView (StoryBoard) [英] UIScrollView when Autolayout is turned on (StoryBoard)
问题描述
我正在与 UIScrollview 搏斗,它把我击倒了.我试图参考以下两篇关于 stackOverFlow 的帖子
I was wrestling with UIScrollview and it knocked me out. I tried to take reference from following two post on stackOverFlow
scrollview xcode4.5 自动布局、Xcode 4.5 UIScrollView,在 iOS 6 上使用自动布局在 ScrollView 中嵌入 ImageView一>,
我尝试了 viewDidLayoutSubviews,如UIScrollView setContentSize 使用自动布局破坏视图,导致我的应用崩溃.
I tried viewDidLayoutSubviews, as told in UIScrollView setContentSize breaks view with Auto Layout that is causing my app to crash.
我尝试了 ViewDidLoad、viewDidAppear 和 viewWillAppear,但没有任何效果.我试过谷歌,发现了更多相关的帖子https://coderwall.com/p/zfe8da、http://www.devx.com/wireless/Article/45113
And I tried ViewDidLoad, viewDidAppear and viewWillAppear but nothing worked. I tried google and found couple more related post https://coderwall.com/p/zfe8da, http://www.devx.com/wireless/Article/45113
我试图重新思考,但没有发现我没有做的任何花哨的事情.看似简单、直接的方法.
I tried to rethink and didnt find anything fancy that I was not doing. It seems simple, straight approach.
我没有任何线索或任何猜测,请帮助我.
I am out of clues or any guess please help me.
我正在使用以下代码,只是提到我在 ScrollView 中放入了 3 个图像.我把它们叠在一起,所以高度超过了 iPhone 屏幕的高度.我期待它我设置它们只是简单地滚动,但我猜我错了.在实现文件中
I am using following code, just to mentioned I have 3 images that I have put in the ScrollView. I have stack them on top of each other so there height is more than iPhone screen height. I was expecting it I set them just scroll simple, but guess I was wrong. In Implementation file
_howtoScrollView.frame = CGRectMake(0, 0, 320, 460);
_howtoScrollView.scrollEnabled = YES;
[self.howtoScrollView setContentSize:CGSizeMake(self.howtoScrollView.frame.size.width, 700)];
[self.view addSubview:_howtoScrollView];
在界面文件 .h
@property (weak, nonatomic) IBOutlet UIScrollView *howtoScrollView;
在使用 StoryBoard Autolayout 的同时使用 ScrollView 取得成功的任何人.
Anyone who got success with ScrollView while having StoryBoard Autolayout.
推荐答案
我也遇到了这个问题.苹果在发行说明中隐藏了解释.http://developer.apple.com/library/ios/#releasenotes/General/RN-iOSSDK-6_0.查看 UIKit 部分下方.
I had this problem too. Apple hid the explanation in the release notes. http://developer.apple.com/library/ios/#releasenotes/General/RN-iOSSDK-6_0. Look under the UIKit section.
这篇关于自动布局打开时的 UIScrollView (StoryBoard)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!