taiyang2014

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:@"金额不能为空!"];
        }
    }
}

posted on 2015-09-30 17:39  taiyang2014  阅读(338)  评论(0编辑  收藏  举报

导航