Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Login" message:@"\n\n\n"
- delegate:self cancelButtonTitle:nil otherButtonTitles:@"Login", nil];
- UITextField *userField = [[UITextField alloc] initWithFrame:CGRectMake(12,53,262,25)];
- userField.font = [UIFont systemFontOfSize:18];
- userField.backgroundColor = [UIColor whiteColor];
- userField.placeholder = @"User Name";
- userField.keyboardAppearance = UIKeyboardAppearanceAlert;
- userField.delegate = self;
- userField.autocorrectionType = UITextAutocorrectionTypeNo;
- [userField becomeFirstResponder];
- [alertView addSubview:userField];
- UITextField *passwordField = [[UITextField alloc] initWithFrame:CGRectMake(12,83,262,25)];
- passwordField.font = [UIFont systemFontOfSize:18];
- passwordField.backgroundColor = [UIColor whiteColor];
- passwordField.secureTextEntry = YES;
- passwordField.placeholder = @"Password";
- passwordField.keyboardAppearance = UIKeyboardAppearanceAlert;
- passwordField.autocorrectionType = UITextAutocorrectionTypeNo;
- passwordField.delegate = self;
- [passwordField becomeFirstResponder];
- [alertView addSubview:passwordField];
- [alertView setTransform:CGAffineTransformMakeTranslation(0,109)];
- [alertView show];
- [alertView release];
- [userField release];
- [passwordField release];
- [super viewDidLoad];
- }
- - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
- {
- NSString *title = [alertView buttonTitleAtIndex:buttonIndex];
- if([title isEqualToString:@"Login"])
- {
- //if user name and password is correct....continue
- NSLog(@"user: %@, password: %@", userField.text, passwordField.text);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement