UIAlertView设置文本输入框格式

- (void)viewDidLoad {

    [super viewDidLoad];

   

    UIAlertView * alertV = [[UIAlertView alloc] initWithTitle:@"textfield" message:nil delegate:self cancelButtonTitle:nil otherButtonTitles:@"yes",@"no", nil];

    [alertV setAlertViewStyle:UIAlertViewStylePlainTextInput];//将其设置成文本输入的格式

    [alertV show];

  

}

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex

{

    UITextField *nameField = [alertView textFieldAtIndex:0];//获取对应的文本输入框

    NSLog(@"---%@",nameField.text);

}

posted on 2016-03-07 17:14  X了个code  阅读(417)  评论(0编辑  收藏  举报