Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Login" message:@"\n\n\n"
  2. delegate:self cancelButtonTitle:nil otherButtonTitles:@"Login", nil];
  3.  
  4.  
  5.  
  6. UITextField *userField = [[UITextField alloc] initWithFrame:CGRectMake(12,53,262,25)];
  7. userField.font = [UIFont systemFontOfSize:18];
  8. userField.backgroundColor = [UIColor whiteColor];
  9. userField.placeholder = @"User Name";
  10. userField.keyboardAppearance = UIKeyboardAppearanceAlert;
  11. userField.delegate = self;
  12. userField.autocorrectionType = UITextAutocorrectionTypeNo;
  13. [userField becomeFirstResponder];
  14. [alertView addSubview:userField];
  15.  
  16. UITextField *passwordField = [[UITextField alloc] initWithFrame:CGRectMake(12,83,262,25)];
  17. passwordField.font = [UIFont systemFontOfSize:18];
  18. passwordField.backgroundColor = [UIColor whiteColor];
  19. passwordField.secureTextEntry = YES;
  20. passwordField.placeholder = @"Password";
  21. passwordField.keyboardAppearance = UIKeyboardAppearanceAlert;
  22. passwordField.autocorrectionType = UITextAutocorrectionTypeNo;
  23. passwordField.delegate = self;
  24. [passwordField becomeFirstResponder];
  25. [alertView addSubview:passwordField];
  26.  
  27. [alertView setTransform:CGAffineTransformMakeTranslation(0,109)];
  28. [alertView show];
  29. [alertView release];
  30. [userField release];
  31. [passwordField release];
  32.  
  33.  
  34.  
  35. [super viewDidLoad];
  36. }
  37.  
  38. - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
  39. {
  40. NSString *title = [alertView buttonTitleAtIndex:buttonIndex];
  41.  
  42. if([title isEqualToString:@"Login"])
  43. {
  44. //if user name and password is correct....continue
  45. NSLog(@"user: %@, password: %@", userField.text, passwordField.text);
  46.  
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement