Skip to content

Commit 2fcd950

Browse files
committed
Implement workaround for potential visual glitch
Using CGRectGetMaxY resolves a layout issue where otherwise the inset ends below the navbar (e.g. Phone 14 Pro iOS18), but at the same time it causes an issue with the inset not taking into account the status bar (e.g. iPod Touch iOS15.5). This seems to be caused by calling this method from viewDidLoad instead of willLayoutSubviews. This workaround avoids rework of DetailVC's delicate layout.
1 parent 976c13f commit 2fcd950

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

XBMC Remote/Utilities.m

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,14 @@ + (CGFloat)getTopPadding {
994994
}
995995

996996
+ (CGFloat)getTopPaddingWithNavBar:(UINavigationController*)navCtrl {
997-
CGFloat topPadding = UIApplication.sharedApplication.statusBarFrame.size.height + navCtrl.navigationBar.frame.size.height;
997+
// Workaround: Using CGRectGetMaxY resolves a layout issue where otherwise the inset ends below the navbar (e.g.
998+
// iPhone 14 Pro iOS18), but at the same time it causes an issue with the inset not taking into account the status
999+
// bar (e.g. iPod Touch iOS15.5). This seems to be caused by calling this method from viewDidLoad instead
1000+
// of willLayoutSubviews. This workaround avoids rework of DetailVC's delicate layout.
1001+
CGFloat topPadding = CGRectGetMaxY(navCtrl.navigationBar.frame);
1002+
if (topPadding <= navCtrl.navigationBar.frame.size.height) {
1003+
topPadding = UIApplication.sharedApplication.statusBarFrame.size.height + navCtrl.navigationBar.frame.size.height;
1004+
}
9981005
return topPadding;
9991006
}
10001007

0 commit comments

Comments
 (0)