1 #import "SinglePasswordDialog.h"
3 @implementation SinglePasswordDialog {
7 @synthesize password=_password;
9 - (id)initWithDefault {
10 return [self initWithTitle:@"Password" message:@"Please input password" delegate:self
11 cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
14 - (NSString *)showAndWait {
15 self.alertViewStyle = UIAlertViewStyleSecureTextInput;
19 // Wait in runloop till a button is clicked.
21 [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
22 beforeDate:[NSDate dateWithTimeIntervalSinceNow:300]];
27 #pragma mark - UIAlertViewDelegate
29 - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
31 if (buttonIndex == 0) {
34 } else if (buttonIndex == 1) {
36 UITextField *field = [self textFieldAtIndex:0];
37 NSString *pw = [field.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];