- (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]);
}

最新文章

  1. VS中的活动debug和活动cpu
  2. shell替换一个或多个空格为逗号
  3. Docker个人学习总结
  4. MySql下载安装(Mac平台) 终端启动 XMAPP启动
  5. 嵌套回调异步与$.Deferred异步
  6. CentOS 6.4 安装SecurectCRT并破解
  7. Keil MDK入门---从新建一个工程开始
  8. 【求出所有最短路+最小割】【多校第一场】【G题】
  9. B - 确定比赛名次
  10. 使用ffmpeg 对视频截图,和视频转换格式
  11. Windows Phone开发(41):漫谈关键帧动画之下篇
  12. ubuntu libtiff-dev
  13. ztree 为节点添加点击触发事件
  14. SVN+Axure版本管理&协同设计(一)
  15. idea使用svn出现问题解决办法
  16. BZOJ.4361.isn(DP 树状数组 容斥)
  17. python中几种循环体
  18. [UE4]裁剪 Clipping
  19. linux常用命令:traceroute 命令
  20. Windows下python 安装Mysqldb模块

热门文章

  1. js parseInt和map函数
  2. NOIP2015斗地主[DFS 贪心]
  3. Es6 箭头函数
  4. Spring.net使用说明
  5. jQuery load()方法用法集锦!
  6. Word2Vec 使用总结
  7. 使用TaskManager爬取2万条代理IP实现自动投票功能
  8. FineUI(专业版)实现百变通知框(无JavaScript代码)!
  9. SharpPcap网络包捕获框架的使用--实例代码在vs2005调试通过
  10. no result defined for action