status bar is overlapping with the view in iOS7

扶醉桌前 提交于 2019-12-24 02:33:32

问题


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


回答1:


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




回答2:


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;
}



回答3:


Try this

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

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




回答4:


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];

   .
   .
   .
   .
  }


来源:https://stackoverflow.com/questions/18909991/status-bar-is-overlapping-with-the-view-in-ios7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!