# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1621506140 0 # Node ID 2c2941e01b6749f06617d14b5856dc315d8de605 # Parent 97b30df25fd1a2fb3687508d74881a6f54310998 iOS: Slight refactoring to handle the possibility that the status bar changes size. diff -r 97b30df25fd1 -r 2c2941e01b67 ios/dw.m --- a/ios/dw.m Thu May 20 10:06:07 2021 +0000 +++ b/ios/dw.m Thu May 20 10:22:20 2021 +0000 @@ -1427,8 +1427,8 @@ CGRect frame = [window frame]; DWView *view = nil; UINavigationBar *nav = nil; - NSInteger sbheight = 0; - + NSInteger sbheight = [[[window windowScene] statusBarManager] statusBarFrame].size.height; + for(id obj in array) { if([obj isMemberOfClass:[DWView class]]) @@ -1447,8 +1447,10 @@ { CGRect navrect = [nav frame]; - sbheight = navrect.size.height; navrect.size.width = frame.size.width; + navrect.origin.x = 0; + navrect.origin.y = sbheight; + sbheight += navrect.size.height; [nav setFrame:navrect]; if (@available(iOS 14.0, *)) { @@ -1465,8 +1467,6 @@ // Fallback on earlier versions } } - else - sbheight = [[[window windowScene] statusBarManager] statusBarFrame].size.height; frame.size.height -= sbheight; /* Account for the special area on iPhone X and iPad Pro * https://blog.maxrudberg.com/post/165590234593/ui-design-for-iphone-x-bottom-elements @@ -8015,7 +8015,8 @@ [window setLargeContentTitle:nstitle]; if(flStyle & DW_FCF_TITLEBAR) { - UINavigationBar* navbar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, screenrect.size.width, 60)]; + NSInteger sbheight = [[[window windowScene] statusBarManager] statusBarFrame].size.height; + UINavigationBar* navbar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, sbheight, screenrect.size.width, 40)]; UINavigationItem* navItem = [[UINavigationItem alloc] initWithTitle:nstitle]; [navbar setItems:@[navItem]];