allow to hide cancel-Button in authenticator view controller

so the user is stuck in authentication
This commit is contained in:
Stephan Diederich 2013-08-15 17:27:08 +02:00
parent d7f45267dd
commit 9ae6fa060e
2 changed files with 24 additions and 5 deletions

View File

@ -19,6 +19,11 @@
*/
@property (nonatomic, assign) BOOL requirePassword;
/** configure if user can abort authentication or not
*
* defaults to YES
*/
@property (nonatomic, assign) BOOL showsCancelButton;
/**
* TODO: instead of passing the whole authenticator, we actually only need
* something to create and enqueue BITHTTPOperations

View File

@ -41,11 +41,8 @@
_statusBarStyle = [[UIApplication sharedApplication] statusBarStyle];
[[UIApplication sharedApplication] setStatusBarStyle:(self.navigationController.navigationBar.barStyle == UIBarStyleDefault) ? UIStatusBarStyleDefault : UIStatusBarStyleBlackOpaque];
// Do any additional setup after loading the view.
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
target:self
action:@selector(dismissAction:)];
[self updateCancelButton];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave
target:self
@ -60,6 +57,23 @@
[[UIApplication sharedApplication] setStatusBarStyle:_statusBarStyle];
}
- (void)setShowsCancelButton:(BOOL)showsCancelButton {
if(_showsCancelButton != showsCancelButton) {
_showsCancelButton = showsCancelButton;
[self updateCancelButton];
}
}
- (void) updateCancelButton {
if(self.showsCancelButton) {
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
target:self
action:@selector(dismissAction:)];
} else {
self.navigationItem.leftBarButtonItem = nil;
}
}
#pragma mark - UIViewController Rotation
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation {