UI第十二节
- (void)viewDidLoad {
[super viewDidLoad];
UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
btn.frame = CGRectMake(40, 100, 295, 30);
[btn setTitle:@"Show Alert View" forState:UIControlStateNormal];
[btn addTarget:self action:@selector(btnClicked:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn];
}
- (void)btnClicked:(UIButton *)btn
{
// 实例化 UIAlertView
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"这是Title" message:@"这里是提示的信息" delegate:self cancelButtonTitle:@"取消按钮" otherButtonTitles:@"确认", nil];
// 显示UIAlertView
[alertView show];
}
// 用户点击UIAlertView上的按钮时会调用这个代理方法
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
// 通过ButtonIndex来判断用户点击的是哪一个Button
NSLog(@"%ld, %@", buttonIndex, [alertView buttonTitleAtIndex:buttonIndex]);
}
最新文章
- VS中的活动debug和活动cpu
- shell替换一个或多个空格为逗号
- Docker个人学习总结
- MySql下载安装(Mac平台) 终端启动 XMAPP启动
- 嵌套回调异步与$.Deferred异步
- CentOS 6.4 安装SecurectCRT并破解
- Keil MDK入门---从新建一个工程开始
- 【求出所有最短路+最小割】【多校第一场】【G题】
- B - 确定比赛名次
- 使用ffmpeg 对视频截图,和视频转换格式
- Windows Phone开发(41):漫谈关键帧动画之下篇
- ubuntu libtiff-dev
- ztree 为节点添加点击触发事件
- SVN+Axure版本管理&;协同设计(一)
- idea使用svn出现问题解决办法
- BZOJ.4361.isn(DP 树状数组 容斥)
- python中几种循环体
- [UE4]裁剪 Clipping
- linux常用命令:traceroute 命令
- Windows下python 安装Mysqldb模块