info.plist
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
UIViewController
override var prefersStatusBarHidden: Bool{
return true
}
when i use 6p ,it's ok
but
iphoneX ,it's can't call and StatusBar not hidden
Maybe not a solution to the OP problem, but what could also be the cause for prefersStatusBarHidden not being called is if you have used a second window in your app delegate, eg for displaying a splash screen, and you did not hide it after the splash was shown - then that window gets the events that lead to calling these functions.
Sometimes the network signal is so weak it cannot handle even a simple voice-only phone call. For some, iPhone X uses only a 3G network instead of 4G, which is another huge drawback. If this sounds familiar to you, check the next part of the article to find what can cause the connectivity problems on your iPhone X.
[Solution] Apple Phone not Receiving Calls 1 Reset your network settings. Go to Settings > General > Reset > Reset Network Settings. 2 Try to make or receive calls in another location. 3 Switch to a different network band.... See More....
Property prefersStatusBarHidden is being called on the root view controller of the current view controller. This means that if your app is based on a UISplitViewController for example, you must implement the property in a custom UISplitViewController class. Assuming you have a ViewController contained within UINavigationController.
You need to check if your view controller is included in a container (i.e. UINavigationController). If that is the case, the full procedure is this:
1) Set the View controller-based status bar appearance
value in info.plist file to YES
2) In your child controller add this code:
override var prefersStatusBarHidden: Bool{
return true
}
3) Add this extension:
// gives control of the status bar appearance to the top controller
extension UINavigationController {
override open var childViewControllerForStatusBarHidden: UIViewController? {
return self.topViewController
}
}
You already have point 1 and 2. Same logic applies to UITabBarController
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