开发者

UINavigationController autoresizing views behavior

开发者 https://www.devze.com 2022-12-21 17:24 出处:网络
I\'ve read in Apple\'s documentation about UINavigationController\'s resizing behavior and it hasn\'t been much of a problem until now.

I've read in Apple's documentation about UINavigationController's resizing behavior and it hasn't been much of a problem until now.

I have the following code to set up my UINavigationController's view:

navController.view.frame = CGRectMake(0, 40, 320开发者_开发问答, 420);

and this is sufficient until the view is obscured by a modal view, at which point the view is resized to the default size somewhere between calls of viewWillAppear and viewDidAppear (as UINavigationController inherits from UIViewController).

I'm attempting to keep a banner visible above the UINavigationController (in the 40 by 320 space left available) but this banner is consistently obscured as described above.

Is there a way to surpress UINavigationController's resizing behavior without subclassing UIViewController myself?


In interface builder, you can uncheck the auto-resize checkbox.

In code, it's

[myNavController.view setAutoresizesSubviews: NO];


I'd try

myNavController.superview.autoresizesSubviews = NO

and obviously check myNavController.autoresizingMask

As a last resort, subclass its superview and reimplement layoutSubviews

0

精彩评论

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

关注公众号