Skip to content

Commit 6a22972

Browse files
committed
+ Removed unnecessary condition for iOS11
+ Added UIViewAutoresizingFlexibleWidth to adapt navigation when orientation changes
1 parent ea27afa commit 6a22972

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

LTHPasscodeViewController/LTHPasscodeViewController.m

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
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)
1715
#define LTHiPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
1816

1917
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000
@@ -620,20 +618,15 @@ - (void)_dismissMe {
620618
#pragma mark - UI setup
621619
- (void)_setupNavBarWithLogoutTitle:(NSString *)logoutTitle {
622620
// Navigation Bar with custom UI
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],
621+
UIView *patchView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, LTHMainWindow.frame.size.width, [LTHPasscodeViewController getStatusBarHeight])];
622+
patchView.backgroundColor = [UIColor whiteColor];
623+
patchView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
624+
[self.view addSubview:patchView];
625+
626+
self.navBar =
627+
[[UINavigationBar alloc] initWithFrame:CGRectMake(0, patchView.frame.size.height,
629628
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-
629+
self.navBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
637630
self.navBar.tintColor = self.navigationTintColor;
638631
if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)]) {
639632
self.navBar.barTintColor = self.navigationBarTintColor;
@@ -658,7 +651,7 @@ - (void)_setupNavBarWithLogoutTitle:(NSString *)logoutTitle {
658651
item.hidesBackButton = YES;
659652

660653
[self.navBar pushNavigationItem:item animated:NO];
661-
[LTHMainWindow addSubview:self.navBar];
654+
[self.view addSubview:self.navBar];
662655
}
663656

664657
- (void)_setupViews {

0 commit comments

Comments
 (0)