Why do the safeAreaInsets and safeAreaLayoutGuide seem wrong on the new iPad without status bar?

Viewed 270

If I create a new single view project and add the following code to ViewController.m

-(void)viewWillLayoutSubviews {
    [super viewWillLayoutSubviews];
    UIWindow *window = UIApplication.sharedApplication.windows[0];
    NSLog(@"%@, %@", NSStringFromUIEdgeInsets(window.safeAreaInsets), NSStringFromCGRect([[window safeAreaLayoutGuide] layoutFrame]));
}

I get the following results on the new iPad Pro (12.9 inch) (3rd generation) simulator.

With status bar: {24, 0, 20, 0}, {{0, 24}, {1024, 1322}}

Without status bar: {0, 0, 20, 0}, {{0, 0}, {1024, 1346}}

Why is the top inset 0 or why is the frame y value 0 when there is no status bar? Shouldn't those values be equal to 20 like the bottom inset?

I remove the status bar by setting UIStatusBarHidden=YES and UIViewControllerBasedStatusBarAppearance=NO in the info.plist. The results I get on the iPhones always correctly account for the curved edges.

0 Answers
Related