开发者

UIScrollView as the root view in a UISplitViewController

开发者 https://www.devze.com 2023-02-27 11:38 出处:网络
I have a basic UISplitViewController where the view of the root view controller(i.e. not the detail view) is a UIScrollView.The problem is when I go to set the content size for the UIScrollView, I see

I have a basic UISplitViewController where the view of the root view controller (i.e. not the detail view) is a UIScrollView. The problem is when I go to set the content size for the UIScrollView, I see that the frame.size.width is 768.0 at runtime, even though Interface Builder shows the width as being 320.0.

In other words, I'd like to do the following but the width is 768.0 instead of 320.0. Any thought开发者_开发知识库s. Thanks in advance!

self.dayScrollView.contentSize = CGSizeMake(dayScrollView.frame.size.width, dayScrollView.frame.size.height * 2);


The UISplitViewController is going to resize the view controller to its own content size, which for sure in portrait mode (not sure about landscape off the top of my head) is going to be 768.0. As long as the code you put above is placed in viewWillAppear or a method called later than that, it should work just fine. You may need to elaborate more in case I missed something.

0

精彩评论

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