开发者

Custom size app screen on iPad

I am trying to create a mid-size screen for my app on iPad.

In didFinishLaunchingWithOptions(), I do this:

CGRect winRect = CGRectMake(100,100,500,500);
navController.view.frame = winRect;

the screen comes up fine and I can click aroun开发者_运维知识库d and do stuff until the orientation changes. It takes the screen to original full size - how can I make it stick to my winRect frame? I tried setting the parentViewController.view.frame/view.frame to winRect in willRotateToInterfaceOrientation() but no good.

Any ideas?

Thanks.


Generally, you shouldn't mess with the frame of a view controller's view. View controllers tend to resize their views on many occasions, for example when toolbars and navigation bars are hidden or made visible or when the interface orientation changes.

For custom-sized views, create a separate view, set its frame to your custom size and add it as a subview to your view controller's view.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜