问题
I have a problem in iOS11 with the iPhoneX simulator.
I have a viewcontroller without the statusbar. To do this I add:
- (BOOL)prefersStatusBarHidden {
return YES;
}
It is good so far but the navigationbar overlaps the safearea in the iPhoneX.
How can I fix this?
回答1:
Finally the solution was using safeAreaInsets
if (@available(iOS 11.0, *)) {
UIEdgeInsets safeInsets = UIApplication.sharedApplication.delegate.window.safeAreaInsets;
paddingTop = safeInsets.top;
}
You can do this programatically or using autolayout
来源:https://stackoverflow.com/questions/46453758/navigationbar-without-statusbar-overlaps-safearea-in-ios11