1

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.

enter image description here

How can I fix this?

Pablo Martinez
  • 1,573
  • 12
  • 31

1 Answers1

6

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

enter image description here enter image description here

Pablo Martinez
  • 1,573
  • 12
  • 31