From f114638880a5531b0759dd8a6362fef34c9344fa Mon Sep 17 00:00:00 2001 From: Tiago Fernandez Date: Sun, 26 Aug 2012 15:50:12 +0200 Subject: [PATCH 1/3] Allow passcode view rotation on iPad. --- src/KKPasscodeViewController.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/KKPasscodeViewController.m b/src/KKPasscodeViewController.m index 69c6ec3..c882323 100755 --- a/src/KKPasscodeViewController.m +++ b/src/KKPasscodeViewController.m @@ -43,6 +43,11 @@ @implementation KKPasscodeViewController #pragma mark - #pragma mark UIViewController +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation +{ + return UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad; +} + - (void)loadView { [super loadView]; From d5097b29ca5632790caa005be6969c9a265db8de Mon Sep 17 00:00:00 2001 From: Tiago Fernandez Date: Sun, 26 Aug 2012 15:58:23 +0200 Subject: [PATCH 2/3] Add method to notify the delegate that the passcode lock view will be on screen. This feature allows things like dismissing a popover controller on the iPad. --- src/KKPasscodeSettingsViewController.h | 5 +++++ src/KKPasscodeSettingsViewController.m | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/KKPasscodeSettingsViewController.h b/src/KKPasscodeSettingsViewController.h index dd18fec..90ff392 100755 --- a/src/KKPasscodeSettingsViewController.h +++ b/src/KKPasscodeSettingsViewController.h @@ -29,6 +29,11 @@ */ - (void)didSettingsChanged:(KKPasscodeSettingsViewController*)viewController; +/** + * called when the passcode lock dialog will be presented + */ +- (void)passcodeLockWillBePresented; + @end @interface KKPasscodeSettingsViewController : UITableViewController { diff --git a/src/KKPasscodeSettingsViewController.m b/src/KKPasscodeSettingsViewController.m index e41f1ea..96edfae 100755 --- a/src/KKPasscodeSettingsViewController.m +++ b/src/KKPasscodeSettingsViewController.m @@ -187,6 +187,8 @@ - (void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath*) nav.navigationBar.barStyle = self.navigationController.navigationBar.barStyle; } + [self.delegate passcodeLockWillBePresented]; + [self.navigationController presentModalViewController:nav animated:YES]; @@ -210,9 +212,11 @@ - (void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath*) nav.navigationBar.barStyle = self.navigationController.navigationBar.barStyle; } - [self.navigationController presentModalViewController:nav animated:YES]; - [tableView deselectRowAtIndexPath:indexPath animated:YES]; + [self.delegate passcodeLockWillBePresented]; + + [self.navigationController presentModalViewController:nav animated:YES]; } + [tableView deselectRowAtIndexPath:indexPath animated:YES]; } - (void)didSettingsChanged:(KKPasscodeViewController*)viewController From e481d91c3d0c05b49551d5fbad2b7eb898444d95 Mon Sep 17 00:00:00 2001 From: Tiago Fernandez Date: Sun, 2 Dec 2012 17:00:55 +0100 Subject: [PATCH 3/3] Check whether delegate responds to passcodeLockWillBePresented method prior to calling it. https://github.com/aporat/KKPasscodeLock/pull/11/files#r2151988 --- src/KKPasscodeSettingsViewController.m | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/KKPasscodeSettingsViewController.m b/src/KKPasscodeSettingsViewController.m index 96edfae..9a93af1 100755 --- a/src/KKPasscodeSettingsViewController.m +++ b/src/KKPasscodeSettingsViewController.m @@ -187,11 +187,11 @@ - (void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath*) nav.navigationBar.barStyle = self.navigationController.navigationBar.barStyle; } - [self.delegate passcodeLockWillBePresented]; - + if ([self.delegate respondsToSelector:@selector(passcodeLockWillBePresented)]) { + [self.delegate passcodeLockWillBePresented]; + } [self.navigationController presentModalViewController:nav animated:YES]; - } else if (indexPath.section == 1 && _passcodeLockOn) { KKPasscodeViewController *vc = [[KKPasscodeViewController alloc] initWithNibName:nil bundle:nil]; vc.delegate = self; @@ -212,8 +212,9 @@ - (void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath*) nav.navigationBar.barStyle = self.navigationController.navigationBar.barStyle; } - [self.delegate passcodeLockWillBePresented]; - + if ([self.delegate respondsToSelector:@selector(passcodeLockWillBePresented)]) { + [self.delegate passcodeLockWillBePresented]; + } [self.navigationController presentModalViewController:nav animated:YES]; } [tableView deselectRowAtIndexPath:indexPath animated:YES];