I am migrating my application to iOS 7. For handing the status bar issue I have added this code
if([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0f) { CGRect frame = self.navigationController.view.frame; if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { frame.origin.y = 20; } else { frame.origin.x = 20; } [self.navigationController.view setFrame:frame]; }
This is working fine in normal case. If I am changing orientation (app supports only landscape orientation) or presenting any view controller and dismissing model view controller my view controller alignment changed. The status bar again overlaps my view controller. This piece of code is not working at all. Please guide me to fix this status bar issue.
Case 2: This is how I am presenting my view controller
ZBarReaderViewController *reader = [ZBarReaderViewController new]; reader.readerDelegate = self; if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) reader.supportedOrientationsMask = ZBarOrientationMaskLandscape; else reader.supportedOrientationsMask = ZBarOrientationMaskPortrait; [self presentModalViewController:reader animated:YES];
Ref:
Thanks in advance.
Click the Collapse Pane icon in the space between the Navigation Bar and the Main Window. The Navigation Bar is collapsed, and the Main Window is expanded horizontally across the entire screen. 2. To restore the Navigation Bar to its original width, click the Restore Pane icon on the left side of the window.
@learner Goto info. plist and then select any row. You will see a + sign. Click on Plus sign and from drop down, you should see Status bar style Option.
A navigation bar appears at the top of an app screen, enabling navigation through a hierarchy of content. A navigation bar also provides a natural place to display a screen's title — helping people orient themselves in your app or game — and it can include controls that affect the screen's content.
A status bar appears along the upper edge of the screen and displays information about the device's current state, like the time, cellular carrier, and battery level.
Fix for status bar issue in IOS 7
Finally I fixed the status bar over lap issue using the delta value property in xcode5. First I have increased origin - y 20pxl to all the controller used in the Xib (it seams to be working fine only in IOS 7), after that I set the delta value for all the view controller origin -y to -20 it works fine in both iOS 6 and iOS 7.
Steps to do that.
Xcode 5 provide preview option to view the appearance of the xib in different view based on the OS version.
Choose preview option from assistant editor
Click assistant editor
and choose preview option to preview selected view controller in different version.
view controller view preview option.
in preview you can find the toggle option to preview view in different version. In preview u can feel the status bar issue clearly if its not fixed properly by toggle the version.
Three steps to fix the status bar issue: step 1: Make sure the view target us 7.0 and later in File inspector.
Step 2 : Increase the origin - y with 20 pixel (exactly the size of the status bar) for all the controls added in the view controller.
Step 3 : Set the delta value of origin y to -20 for all the controls then only it will adjust automatically based on the version. Use preview now and feel the differ that the controls automatically adjust because of the delta value.
Once the status bar issue fixed, issue while presenting the model view (ZbarSDk controller) is also fixed automatically.
Preview screen :
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With