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..9a93af1 100755 --- a/src/KKPasscodeSettingsViewController.m +++ b/src/KKPasscodeSettingsViewController.m @@ -187,9 +187,11 @@ - (void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath*) nav.navigationBar.barStyle = self.navigationController.navigationBar.barStyle; } + 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; @@ -210,9 +212,12 @@ - (void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath*) nav.navigationBar.barStyle = self.navigationController.navigationBar.barStyle; } - [self.navigationController presentModalViewController:nav animated:YES]; - [tableView deselectRowAtIndexPath:indexPath animated:YES]; + if ([self.delegate respondsToSelector:@selector(passcodeLockWillBePresented)]) { + [self.delegate passcodeLockWillBePresented]; + } + [self.navigationController presentModalViewController:nav animated:YES]; } + [tableView deselectRowAtIndexPath:indexPath animated:YES]; } - (void)didSettingsChanged:(KKPasscodeViewController*)viewController 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];