Solution of no navigation bar page adaptation problem for iPhone x


The original full screen adaptation in the iPhone x will cause incomplete display due to changes in the security area.

The solution is as follows:

stay self.view Add a view to the view, and the rest of the views are based on the layout of the view, and the constraints of the view change with the layout self.view.safeAreaInsets The change of needs to be reset:

- (void)viewDidLoad {
  [super viewDidLoad];
  // Do any additional setup after loading the view.
  self.view.backgroundColor = [UIColor blackColor];
  if (@available(iOS 11, *)) {
    [self setAdditionalSafeAreaInsets:self.view.safeAreaInsets];
  [self defaultUI];
  [self addNotification];
//New in IOS 11, called when security zone changes
- (void)viewSafeAreaInsetsDidChange{
  [super viewSafeAreaInsetsDidChange];
  [self defaultUIWithSafeAreaInsets:self.view.safeAreaInsets];


The above is Xiaobian’s solution to the problem of iPhone x page adaptation without navigation bar. I hope it can help you. If you have any questions, please leave me a message and Xiaobian will reply you in time. Thank you very much for your support to developer!