码迷,mamicode.com
首页 > 其他好文 > 详细

alertView 上添加textField

时间:2015-09-30 19:37:14      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:

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

alertView 上添加textField

标签:

原文地址:http://www.cnblogs.com/tian-sun/p/4849799.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!