Advertisement
Guest User

Untitled

a guest
Mar 27th, 2015
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. //----adding an alertview----
  2. UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Vehicle Information" message:@"" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Add", nil];
  3. CGRect frame = CGRectMake(0, 0, self.view.frame.size.width, 300);
  4. UIView *view = [[UIView alloc] initWithFrame:frame];
  5.  
  6. UITextField* text1 = [[UITextField alloc] initWithFrame: CGRectMake(10, 10,self.view.frame.size.width-125, 30)];
  7. text1.backgroundColor=[UIColor whiteColor];
  8. UITextField* text2 = [[UITextField alloc] initWithFrame: CGRectMake(10, 45, self.view.frame.size.width-125, 30)];
  9. text2.backgroundColor=[UIColor whiteColor];
  10. UITextField* text3 = [[UITextField alloc] initWithFrame: CGRectMake(10, 80, self.view.frame.size.width-125, 30)];
  11. text3.backgroundColor=[UIColor whiteColor];
  12. text1.layer.borderColor=[UIColor lightGrayColor].CGColor;
  13. text1.layer.borderWidth=1;
  14. text2.layer.borderColor=[UIColor lightGrayColor].CGColor;
  15. text2.layer.borderWidth=1;
  16. text3.layer.borderColor=[UIColor lightGrayColor].CGColor;
  17. text3.layer.borderWidth=1;
  18. text1.placeholder=@"Year";
  19. text2.placeholder=@"Make";
  20. text3.placeholder=@"Model";
  21. [view addSubview:text1];
  22. [view addSubview:text2];
  23. [view addSubview:text3];
  24. [alertView setValue:view forKey:@"accessoryView"];
  25. view.backgroundColor = [UIColor whiteColor];
  26. alertView.tag = 1;
  27. [alertView show];
  28.  
  29. - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
  30. NSLog(@"AlertView is Active");
  31. if (alertView.tag == 1 && buttonIndex != [alertView cancelButtonIndex]) {
  32. NSLog(@"alert view working");
  33. NSString *Year = [[alertView textFieldAtIndex:0] text];
  34. NSLog(@"%@",Year);
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement