博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
UIAlertView添加textField
阅读量:6897 次
发布时间:2019-06-27

本文共 1033 字,大约阅读时间需要 3 分钟。

- (IBAction)Open:(id)sender {

    

    UIAlertView* dialog = [[UIAlertView alloc] initWithTitle:@"Enter Name" message:@"" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Add",nil]; 

    [dialog setAlertViewStyle:UIAlertViewStyleLoginAndPasswordInput];

    

    // Change keyboard type

    [[dialog textFieldAtIndex:0] setKeyboardType:UIKeyboardTypeNumberPad];

    [[dialog textFieldAtIndex:1] setKeyboardType:UIKeyboardTypeNumberPad];

    [dialog show];

}

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{

    if(buttonIndex == 1)

        NSLog(@"%@",[[alertView textFieldAtIndex:0]text]);

}

II

- (IBAction)Open:(id)sender {

    

   UIAlertView *alert = [[UIAlertView alloc]initWithTitle:nil message:@" " delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定那个", nil];

    

    

    UITextField * nameField = [[UITextField alloc] initWithFrame:CGRectMake(20.0, 45.0, 245.0, 25.0)];

    [nameField setBackgroundColor:[UIColor whiteColor]];

    

    [alert addSubview:nameField];

    

    [alert show];

}

转载于:https://www.cnblogs.com/zzili/archive/2012/12/06/6663237.html

你可能感兴趣的文章
(转载)centos6.5下安装mysql
查看>>
宽带用户防范“***”***十大招式
查看>>
PHP5.4第一天—基本语法
查看>>
thinkphp 5.0 index.php被替换成首页内容,被注入恶意代码
查看>>
Linux定制自动安装
查看>>
尝试搭建一个日志服务器
查看>>
android开源工程--开篇
查看>>
CentOS6上mongodb连接数无法突破1000的解决办法
查看>>
linux 修改 计算 名称 root@localhost
查看>>
oracle计算日期只差得出季度
查看>>
linux 下查找大于100M的文件
查看>>
shell介绍、历史命令、命令补全和别名、通配符、输入输出重定向
查看>>
Win下如何更改mysql数据库的默认字符集编码方式
查看>>
在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或......
查看>>
【转】[行业透视] 外企九年-我最终选择放弃
查看>>
最终目标展示:一个完善的操作系统
查看>>
opencv图像融合(给人脸添加一个眼镜)
查看>>
mysql参数优化辅助工具之tuning-primer.sh
查看>>
SpringBoot之整合MyBatis
查看>>
docker 笔记
查看>>