AlgoCoder
AlgoCoder

Reputation: 1696

status bar is overlapping with the view in iOS7

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

Upvotes: 2

Views: 4895

Answers (4)

Sabareesh
Sabareesh

Reputation: 3605

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

Upvotes: 2

Deepesh
Deepesh

Reputation: 8053

Try this

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

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

Upvotes: 1

Gagan Joshi
Gagan Joshi

Reputation: 3387

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

Upvotes: 1

metsburg
metsburg

Reputation: 2021

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

   .
   .
   .
   .
  }

Upvotes: 0

Related Questions