I noticed a bug on rotation change in my app on iPhone 14 Pro Max simulator. Basically a view in my view hierarchy is hidden when it shouldn't be. In landscape mode there isn't enough room for this view so I hide it on the iPhone (not essential). But when tilting back to portrait mode I unhide it.
-(void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
BOOL isIPhone = UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPhone;
BOOL isIPhoneAndGoingLandscapeMode = (isIPhone
&& size.width > size.height);
if (isIPhoneAndGoingLandscapeMode)
{
self.someView.hidden = YES;
}
else
{
self.someView.hidden = NO;
}
}
So this view controller is presented modally (form sheet style).
On iPhone 14 Pro Max on orientation -viewWillTransitionToSize:withTransitionCoordinator: is called twice and the size parameter is always:
(CGSize) size = (width = 414, height = 394)
This is the sized passed to my app when rotating to portrait and landscape so my isIPhoneAndGoingLandscapeMode flag always is YES because 414 > 394. The 414 x 394 size appears to be false.
My view controller's view in landscape on iPhone 14 pro max logs out to:
(origin = (x = 0, y = 0), size = (width = 932, height = 430))
And 932 x 430 is the size I expected to be passed to me in -viewWillTransitionToSize:withTransitionCoordinator:
Unless I'm missing something can this behavior be explained?