status bar is overlapping with the view in iOS7

2019-07-12 08:27发布

status bar is overlapping with the view How do I set the view below the status bar in iOS7 I'm using XIB not a storyboard

4条回答
干净又极端
2楼-- · 2019-07-12 09:06

Try this

 if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
    self.edgesForExtendedLayout = UIRectEdgeNone;   // iOS 7 specific

You need add the above in your -(void)viewDidLoad method.

查看更多
劳资没心,怎么记你
3楼-- · 2019-07-12 09:26

Try this:

If you want to disable the status bar from plist, try this:

   Status bar is initially hidden : YES
   View controller-based status bar appearance : NO

this is necessary for iOS 7, works for me. Set these two tags in your info.plist.

Everytime your viewcontroller appears, in viewDidLoad or when image picker controller finishes , use this:

 - (void) imagePickerController:(UIImagePickerController *)picker1 didFinishPickingImage:       (UIImage *)image editingInfo:(NSDictionary *)editingInfo
  {
      [[UIApplication sharedApplication] setStatusBarHidden:YES];

   .
   .
   .
   .
  }
查看更多
我想做一个坏孩纸
4楼-- · 2019-07-12 09:30

In iOS 7.0, UI statusbar is transparent, To accommodate the changes in the app as with the status bar style you can use:

 UIStatusBarStyleDefault

for Status bar to be dark while for light content use

 UIStatusBarStyleLightContent

If facing trouble with background image of View in app where the image is extending itself behind the status bar. Set the image in nib or programmatically(whichever suits you) explicitly with the dimensions on Image.

For More References on UI Changes refer this Guide by Apple. https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/TransitionGuide/TransitionGuide.pdf

查看更多
放我归山
5楼-- · 2019-07-12 09:31

I used following code for solve the problem.

- (void) viewDidLayoutSubviews {
    CGRect viewBounds = self.view.bounds;
    CGFloat topBarOffset = self.topLayoutGuide.length;
    viewBounds.origin.y = topBarOffset * -1;
    self.view.bounds = viewBounds;
}
查看更多
登录 后发表回答