Skip to content

Commit c82b384

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 64bc096 commit c82b384

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
@@ -965,7 +965,14 @@ + (CGFloat)getTopPadding {
965965
}
966966

967967
+ (CGFloat)getTopPaddingWithNavBar:(UINavigationController*)navCtrl {
968-
CGFloat topPadding = UIApplication.sharedApplication.statusBarFrame.size.height + navCtrl.navigationBar.frame.size.height;
968+
// Workaround: Using CGRectGetMaxY resolves a layout issue where otherwise the inset ends below the navbar (e.g.
969+
// iPhone 14 Pro iOS18), but at the same time it causes an issue with the inset not taking into account the status
970+
// bar (e.g. iPod Touch iOS15.5). This seems to be caused by calling this method from viewDidLoad instead
971+
// of willLayoutSubviews. This workaround avoids rework of DetailVC's delicate layout.
972+
CGFloat topPadding = CGRectGetMaxY(navCtrl.navigationBar.frame);
973+
if (topPadding <= navCtrl.navigationBar.frame.size.height) {
974+
topPadding = UIApplication.sharedApplication.statusBarFrame.size.height + navCtrl.navigationBar.frame.size.height;
975+
}
969976
return topPadding;
970977
}
971978

0 commit comments

Comments
 (0)