我在iOS11中遇到了iPhoneX模拟器的问题。
我有一个没有状态栏的viewcontroller。为此,我添加了:
- (BOOL)prefersStatusBarHidden { return YES; }
目前为止还不错,但导航栏与iPhoneX中的安全区域重叠。
我怎样才能解决这个问题?
最后,解决方案是使用 safeAreaInsets
safeAreaInsets
if (@available(iOS 11.0, *)) { UIEdgeInsets safeInsets = UIApplication.sharedApplication.delegate.window.safeAreaInsets; paddingTop = safeInsets.top; }