开发者

UIView doesn't resize when hiding the statusBar

开发者 https://www.devze.com 2023-01-20 06:28 出处:网络
Everything is in the title, here some things that I tried : [[UIApplication sharedApplication] setStatusBarHidden:YES];

Everything is in the title, here some things that I tried :

    [[UIApplication sharedApplication] setStatusBarHidden:YES];
[self setWantsFullScreenLayout:YES];
[[self view] setNeedsLayout];
CGRect frame = self.view.frame;
frame.size.height += 20.0;
[[self view] setFrame:frame];

Could you tell me what to do? I thing it might be 开发者_StackOverflowsomething else in the code, since with a simple clear project, it's working.


You probably need to change the position of the frame, as well as its height.

frame.origin.y -= 20.0;
frame.size.height +=20.0;


Did you assign values for following properties of UIView?

  • @property(nonatomic) BOOL autoresizesSubviews
  • @property(nonatomic) UIViewAutoresizing autoresizingMask

I had used Ben's method before for status bar's problem, but I think it should have another elegant way for this.

0

精彩评论

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

关注公众号