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);

}

原文地址:https://www.cnblogs.com/pangbin/p/5251168.html