From iOS 14.x SafeAreaInset becomes Zero when transform scale

From iOS 14.x SafeAreaInset becomes Zero when transform scale. Its working on iOS 13 and below.

Replies

Adding additional information :-

CGAffineTransformMakeScale and navigation bar hidden overlapping status bar in iOS 14.x and above in iPad device

It's working on iOS 13 and below.
When i debug, i can see the safe area inset is zero for iOS 14.3 & iOS 14.4 iPad 7th generation.

To Reproduce a issue:-
Orientation Support - iPad Landscape
Deployment target - 10.0
Subclass UINavigationController and add the below code in viewDidLoad. Also add below category UIScreen
  • (void)viewDidLoad

{
[super viewDidLoad];
self.navigationBar.barTintColor = [UIColor clearColor];
self.navigationBar.hidden = YES;
Code Block
CGFloat heightScale = [[UIScreen mainScreen] heightScaleTo:768];
self.view.transform = CGAffineTransformMakeScale(heightScale, heightScale);
}

@implementation UIScreen (Additions)
  • (CGFloat)heightScaleTo:(CGFloat)targetHeight

{
if(targetHeight <= 0)
{
return self.bounds.size.height;
}
Code Block
return self.bounds.size.height / targetHeight;
}


@end