Mercurial > dwindows
changeset 2570:2c2941e01b67
iOS: Slight refactoring to handle the possibility that the status bar
changes size.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 20 May 2021 10:22:20 +0000 |
parents | 97b30df25fd1 |
children | e34b627b2491 |
files | ios/dw.m |
diffstat | 1 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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]];