Skip to content

Commit

Permalink
Merge pull request #51 from venmo/ma/custom-nav-bar
Browse files Browse the repository at this point in the history
Allow custom navigation bar classes
  • Loading branch information
dasmer committed Jun 5, 2015
2 parents 79bb07f + 4f706ab commit 124496b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion VENTouchLock/Categories/UIViewController+VENTouchLock.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
+ (UIViewController*)ventouchlock_topMostController;

/**
* @param navigationBarClass The navigation bar class that should be used to initialize the navigation controller. Defaults to UINavigationBar.
* @return A navigation controller that contains the reciever as its root view controller.
*/
- (UINavigationController *)ventouchlock_embeddedInNavigationController;
- (UINavigationController *)ventouchlock_embeddedInNavigationControllerWithNavigationBarClass:(Class)navigationBarClass;

@end
6 changes: 3 additions & 3 deletions VENTouchLock/Categories/UIViewController+VENTouchLock.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

@implementation UIViewController (VENTouchLock)

- (UINavigationController *)ventouchlock_embeddedInNavigationController
- (UINavigationController *)ventouchlock_embeddedInNavigationControllerWithNavigationBarClass:(Class)navigationBarClass
{
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:self];
navigationController.navigationBar.translucent = NO;
UINavigationController *navigationController = [[UINavigationController alloc] initWithNavigationBarClass:navigationBarClass toolbarClass:nil];
[navigationController pushViewController:self animated:NO];
return navigationController;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ - (void)finishWithResult:(BOOL)success animated:(BOOL)animated

- (UINavigationController *)embeddedInNavigationController
{
return [super ventouchlock_embeddedInNavigationController];
return [super ventouchlock_embeddedInNavigationControllerWithNavigationBarClass:self.touchLock.appearance.navigationBarClass];
}

- (void)keyboardWillShow:(NSNotification *)notification
Expand Down
2 changes: 2 additions & 0 deletions VENTouchLock/Models/VENTouchLockAppearance.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,6 @@

@property (assign, nonatomic) BOOL touchIDCancelPresentsPasscodeViewController;

@property (strong, nonatomic) Class navigationBarClass;

@end
1 change: 1 addition & 0 deletions VENTouchLock/Models/VENTouchLockAppearance.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ - (instancetype)init
_enterPasscodeViewControllerTitle = NSLocalizedString(@"Enter Passcode", nil);
_splashShouldEmbedInNavigationController = NO;
_touchIDCancelPresentsPasscodeViewController = NO;
_navigationBarClass = [UINavigationBar class];
}
return self;
}
Expand Down
4 changes: 2 additions & 2 deletions VENTouchLock/VENTouchLock.m
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ - (void)lock
UIViewController *rootViewController = [UIViewController ventouchlock_topMostController];
UIViewController *displayController;
if (self.appearance.splashShouldEmbedInNavigationController) {
displayController = [splashViewController ventouchlock_embeddedInNavigationController];
displayController = [splashViewController ventouchlock_embeddedInNavigationControllerWithNavigationBarClass:self.appearance.navigationBarClass];
}
else {
displayController = splashViewController;
Expand All @@ -198,7 +198,7 @@ - (void)lock
[snapshotSplashViewController setIsSnapshotViewController:YES];
UIViewController *snapshotDisplayController;
if (self.appearance.splashShouldEmbedInNavigationController) {
snapshotDisplayController = [snapshotSplashViewController ventouchlock_embeddedInNavigationController];
snapshotDisplayController = [snapshotSplashViewController ventouchlock_embeddedInNavigationControllerWithNavigationBarClass:self.appearance.navigationBarClass];
}
else {
snapshotDisplayController = snapshotSplashViewController;
Expand Down

0 comments on commit 124496b

Please sign in to comment.