alertView 上添加textField

- (void)showTextFieldUIAlertView
{
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"请输入消费金额" message:nil delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
    alertView.alertViewStyle = UIAlertViewStylePlainTextInput;
    [[alertView textFieldAtIndex:0] setKeyboardType:UIKeyboardTypeNumberPad];
    [alertView show];
}

- (void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    UITextField *txt = [alertView textFieldAtIndex:0];
   
    if (buttonIndex == 1) //确定
    {
        if (txt.text.length > 0)
        {
        controller.strTotalFee = txt.text;
        else
        {
            [SVProgressHUD showErrorWithStatus:@"金额不能为空!"];
        }
    }
}
原文地址:https://www.cnblogs.com/tian-sun/p/4849799.html