Skip to content

Commit ba48f73

Browse files
committed
Fix navigation bar layout when present passcode with logout enabled in iOS11
1 parent 828115c commit ba48f73

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

LTHPasscodeViewController/LTHPasscodeViewController.m

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
#define LTHiOS8 ([[[UIDevice currentDevice] systemVersion] compare:@"8.0" \
1414
options:NSNumericSearch] != NSOrderedAscending)
15+
#define LTHiOS11 ([[[UIDevice currentDevice] systemVersion] compare:@"11.0" \
16+
options:NSNumericSearch] != NSOrderedAscending)
1517
#define LTHiPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
1618

1719
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000
@@ -618,9 +620,20 @@ - (void)_dismissMe {
618620
#pragma mark - UI setup
619621
- (void)_setupNavBarWithLogoutTitle:(NSString *)logoutTitle {
620622
// Navigation Bar with custom UI
621-
self.navBar =
622-
[[UINavigationBar alloc] initWithFrame:CGRectMake(0, LTHMainWindow.frame.origin.y,
623-
LTHMainWindow.frame.size.width, 64)];
623+
if (LTHiOS11) {
624+
UIView *patchView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, LTHMainWindow.frame.size.width, [LTHPasscodeViewController getStatusBarHeight])];
625+
patchView.backgroundColor = [UIColor whiteColor];
626+
[self.view addSubview:patchView];
627+
self.navBar =
628+
[[UINavigationBar alloc] initWithFrame:CGRectMake(0, [LTHPasscodeViewController getStatusBarHeight],
629+
LTHMainWindow.frame.size.width, 44)];
630+
}
631+
else {
632+
self.navBar =
633+
[[UINavigationBar alloc] initWithFrame:CGRectMake(0, LTHMainWindow.frame.origin.y,
634+
LTHMainWindow.frame.size.width, 64)];
635+
}
636+
624637
self.navBar.tintColor = self.navigationTintColor;
625638
if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)]) {
626639
self.navBar.barTintColor = self.navigationBarTintColor;

0 commit comments

Comments
 (0)