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
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.
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.
This should give you layouts that look like this:
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 landscape
iPad
iPad Landscape
iPhone X
iPhone XR
Related Topics
(iOS + Storekit) How to Detect When I'm in the Sandbox
How to Check If Haptic Engine (Uifeedbackgenerator) Is Supported
Intercept Request with Wkwebview
Alphabetical Sections in Table Table View in Swift
Not Receiving Any Push Notification in Iphone
A Server with the Specified Hostname Could Not Be Found
Push View Programmatically in Callback, Swiftui
"Unable to Validate Your Application Error" While Uploading a New Version of iOS App
Can't Import Embedded Framework with Xcode 6 Gm
Storyboard Instantiateviewcontrollerwithidentifier Not Setting Iboutlets
Best Way to Save and Retrieve Uicolors to Core Data
How to Write Application Logs to File and Get Them
Swift: Natively Detect If App Has Crashed
Communicating With/Opening Containing App from Share Extension
Swift: Custom Camera Save Modified Metadata with Image
How to Draw a Route Between Two Locations Using Mapkit in Swift
Will Appstore Reviewers Allow Us to Use Dynamic Library in iOS8