Status Bar Visible on iPad Mini Despite Setting Uiviewcontrollerbasedstatusbarappearance to No

Status bar visible on iPad mini despite setting UIViewControllerBasedStatusBarAppearance to NO

This is a bug in the iPad Mini iOS version 7.1.

In typical fashion, they fixed one problem (a blank status bar) and created another one.

Be sure to report the error to Apple.

Cannot hide status bar in iOS7

in your apps plist file add a row call it "View controller-based status bar appearance" and set it to NO

Note that this simply does not work, if you are using UIImagePickerController in the app.

from http://www.openfl.org/developer/forums/general-discussion/iphone-5ios-7-cant-hide-status-bar/, mgiroux's solution

An example adding View Base Controller to your Info settings in Xcode

Status bar on iPad with iOS 7 (iPad/iPad mini)

Add this to your Plist file:

UIViewControllerBasedStatusBarAppearance and set it to NO

and

UIStatusBarHidden and set that one to YES

iOS 7 Status Bar won't go away despite everything set to hide it

The solution to this is actually very simple. There is a setting you need to add to your project plist file called View controller-based status bar appearance which needs to be set to NO.

View controller setting for the plist file

The key pair is as follows:

UIViewControllerBasedStatusBarAppearance => NO

In the end your plist should look like this:

<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIStatusBarHidden</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>

prefersStatusBarHidden isn't getting called

There is a little bit cleaner solution. There is a function childViewControllerForStatusBarHidden which is specifically designed to return a child view controller to which prefersStatusBarHidden should be forwarded.

So, it will be better to override it. It will look like this:

override func childViewControllerForStatusBarHidden() -> UIViewController? {
if var topViewController = self.viewControllers.first {
if let navigationController = topViewController as? UINavigationController {
topViewController = navigationController.topViewController!
}
return topViewController
}

return super.childViewControllerForStatusBarHidden()
}

And probably you can even omit following. NavigationViewController has childViewControllerForStatusBarHidden() on it's own which will send it to child viewcontroller.

  if let navigationController = topViewController as? UINavigationController {
topViewController = navigationController.topViewController!
}

WKWebView not staying flush with status bar

From what I have seen in the images you posed, you don't have any layout constraints for the WebView, which I think explains what you are seeing. Without those constrains, the view will not be resized to fit various devices. Below is what I would suggest for constraints if you want things "flush" to top and bottom bars (important to place the constraint against the SafeArea). To add these constraints drag the web view to the edges of the display until you see the a dotted blue line and then click the button that looks like a tie-fighter (second button from right) and then click the red dotted |---| symbols to apply constraints in each direction.

Sample Image

This should give you layouts that look like this:

Sample Image

When running in the simulator, you get the the results shown below. You can see things look a bit different on the iPhone X devices, but this how things are designed on those devices to make sure the controls are accessible. One thing I did notice was that the grey area you see in Xcode for the web view, does not correctly move when you change the orientation or size of the device in Xcode. However, the edges of the display do move correctly so I would chalk that up to a bug Xcode.

Really hope that helps. I remember being very confused when it came to constraints when I first started. It takes a bit to get your head around things.

iPhone 8
iPhone 8
iPhone 8 landscape
iPhone8
iPad
iPad
iPad Landscape
iPad
iPhone X
iPhoneX
iPhone XR
iPhoneX



Related Topics



Leave a reply



Submit