Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //----adding an alertview----
- UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Vehicle Information" message:@"" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Add", nil];
- CGRect frame = CGRectMake(0, 0, self.view.frame.size.width, 300);
- UIView *view = [[UIView alloc] initWithFrame:frame];
- UITextField* text1 = [[UITextField alloc] initWithFrame: CGRectMake(10, 10,self.view.frame.size.width-125, 30)];
- text1.backgroundColor=[UIColor whiteColor];
- UITextField* text2 = [[UITextField alloc] initWithFrame: CGRectMake(10, 45, self.view.frame.size.width-125, 30)];
- text2.backgroundColor=[UIColor whiteColor];
- UITextField* text3 = [[UITextField alloc] initWithFrame: CGRectMake(10, 80, self.view.frame.size.width-125, 30)];
- text3.backgroundColor=[UIColor whiteColor];
- text1.layer.borderColor=[UIColor lightGrayColor].CGColor;
- text1.layer.borderWidth=1;
- text2.layer.borderColor=[UIColor lightGrayColor].CGColor;
- text2.layer.borderWidth=1;
- text3.layer.borderColor=[UIColor lightGrayColor].CGColor;
- text3.layer.borderWidth=1;
- text1.placeholder=@"Year";
- text2.placeholder=@"Make";
- text3.placeholder=@"Model";
- [view addSubview:text1];
- [view addSubview:text2];
- [view addSubview:text3];
- [alertView setValue:view forKey:@"accessoryView"];
- view.backgroundColor = [UIColor whiteColor];
- alertView.tag = 1;
- [alertView show];
- - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
- NSLog(@"AlertView is Active");
- if (alertView.tag == 1 && buttonIndex != [alertView cancelButtonIndex]) {
- NSLog(@"alert view working");
- NSString *Year = [[alertView textFieldAtIndex:0] text];
- NSLog(@"%@",Year);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement