OC_UIAlertView添加UITextField

OC_UIAlertView添加UITextField_第1张图片
效果图
    UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:@"请输入对方付款码"
                                                         message:nil delegate:self
                                               cancelButtonTitle:@"取消"
                                               otherButtonTitles:@"收款", nil];
/*
UIAlertViewStyle
    UIAlertViewStyleDefault = 0,
    UIAlertViewStyleSecureTextInput,
    UIAlertViewStylePlainTextInput,
    UIAlertViewStyleLoginAndPasswordInput
*/
    [alertView setAlertViewStyle:UIAlertViewStylePlainTextInput];
    
    _textField = [alertView textFieldAtIndex:0];
    _textField.placeholder = @"18位付款码 在条形码下方";
    _textField.keyboardType = UIKeyboardTypeNumberPad;
    
    [alertView show];

你可能感兴趣的:(OC_UIAlertView添加UITextField)