@implementation ViewController

- (void)viewDidLoad {
[super viewDidLoad]; UIButton *_button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[_button setTitle:@"按钮" forState:UIControlStateNormal];
_button.frame = CGRectMake(, , , ); [self.view addSubview:_button]; [_button addTarget:self action:@selector(doClick) forControlEvents:UIControlEventTouchDown]; } -(void)doClick{ // UIAlertControllerStyleAlert 替代 UIAlertView
// UIAlertControllerStyleActionSheet 替代 UIActionSheet
// UIAlertionSheet是标准的确认-取消选择框,要求至少要两个按钮
UIAlertController *_alertcontroller = [UIAlertController alertControllerWithTitle:@"标题" message:@"提示信息" preferredStyle:UIAlertControllerStyleAlert]; // 蓝色加粗
UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
NSLog(@"cancel");
}]; // 蓝色
UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"default" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
NSLog(@"default");
}]; // 红色
UIAlertAction *action3 = [UIAlertAction actionWithTitle:@"Destructive" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
NSLog(@"Destructive");
}]; [_alertcontroller addAction:action1];
[_alertcontroller addAction:action2];
[_alertcontroller addAction:action3]; [self presentViewController:_alertcontroller animated:YES completion:nil];
} @end

UI控件(UIAlertController)的更多相关文章

  1. Swift UI控件详细介绍(上)

    UI控件 首先介绍一下AppDelegate.swift@UIApplicationMain 调用了OC中的UIApplicationMain函数:UIApplicationMain是iOS应用程序的 ...

  2. iOS基础UI控件介绍-Swift版

    iOS基础UI控件总结 iOS基础控件包括以下几类: 1.继承自NSObject:(暂列为控件) UIColor //颜色 UIImage //图像 2.继承自UIView: 只能相应手势UIGest ...

  3. ANDROID L——Material Design详解(UI控件)

    转载请注明本文出自大苞米的博客(http://blog.csdn.net/a396901990),谢谢支持! Android L: Google已经确认Android L就是Android Lolli ...

  4. WinForm/Silverlight多线程编程中如何更新UI控件的值

    单线程的winfom程序中,设置一个控件的值是很easy的事情,直接 this.TextBox1.value = "Hello World!";就搞定了,但是如果在一个新线程中这么 ...

  5. 富客户端 wpf, Winform 多线程更新UI控件

    前言 在富客户端的app中,如果在主线程中运行一些长时间的任务,那么应用程序的UI就不能正常相应.因为主线程要负责消息循环,相应鼠标等事件还有展现UI. 因此我们可以开启一个线程来格外处理需要长时间的 ...

  6. UI控件(复习一下)

    如何修改控件状态• 可见,确实需要经常修改控件状态• 那如何去修改控件的状态呢?方法很简单➢ 每一个UI控件都是一个对象➢ 修改UI控件的状态,其实就是修改控件对象的属性➢ 比如修改UILabel显示 ...

  7. IOS学习资源收集--开发UI控件相关

    收集的一些本人了解过的iOS开发UI控件相关的代码资源(本文持续补充更新) 内容大纲: 1.本人在github上也上传了我分装好的一些可重复利用的UI控件 2.计时相关的自定义UILabel控件 正文 ...

  8. 《深入理解Windows Phone 8.1 UI控件编程》基于最新的Runtime框架

    <深入理解Windows Phone 8.1 UI控件编程>本书基于最新的Windows Phone 8.1 Runtime SDK编写,全面深入地论述了最酷的UI编程技术:实现复杂炫酷的 ...

  9. AppleWatch___学习笔记(二)UI布局和UI控件

    1.UI布局 直接开发,你会发现Apple Watch并不支持AutoLayout,WatchKit里有个类叫做WKInterfaceGroup,乍一看像是UIView,但是这货其实是用来布局的.从 ...

  10. (转).NET 4.5中使用Task.Run和Parallel.For()实现的C# Winform多线程任务及跨线程更新UI控件综合实例

    http://2sharings.com/2014/net-4-5-task-run-parallel-for-winform-cross-multiple-threads-update-ui-dem ...

随机推荐

  1. *** wechat-php-sdk 微信公众平台php开发包

    wechat-php-sdk 微信公众平台php开发包,细化各项接口操作,支持链式调用,欢迎Fork此项目weixin developer SDK. 项目地址:https://github.com/d ...

  2. 杨氏矩阵:查找x是否在矩阵中,第K大数

    参考:http://xudacheng06.blog.163.com/blog/static/4894143320127891610158/ 杨氏矩阵(Young Tableau)是一个很奇妙的数据结 ...

  3. jq size()与length的区别

    size()跟length同样的功能,都是取元素的个数,那么他们的区别是什么呢,一个是方法一个是属性? 从图中可以看到size()方法比length慢38%,原因何在? size: function ...

  4. MongoVUE1.6.9破解启动提示System.ArgumentException: 字体“Courier New”不支持样式“Regular”

    用MongoVUE,发现报错,报错信息如下: System.ArgumentException: 字体"Courier New"不支持样式"Regular". ...

  5. python 小程序大文件的拆分合并

    1. 将大文件拆分为小文件 I 通过二进制的方式将大文件读取出来,将其拆分存,以不同的文件方式存放在一个目录下面 II 提供两种操作方式交互式和命令行模式 #! usr/bin/python # -* ...

  6. wpf 切换资源字典的2中方式

    var _1200RDUri = new Uri(String.Format(@"/aa;Component/Themes/1200Theme.xaml"), UriKind.Re ...

  7. backup

    1.垂直居中 2.敏捷开发,bug级别划分 3.bash构建,设计模式 4.git reset  revoke rebase 区别 vue -validator 规则 • required: 是否是必 ...

  8. liunux 修改hostname

    最近鼓捣Oracle,记录些技巧 修改hostname # vim /ect/hosts # vim /etc/sysconfig/network 修改hostname # service netwo ...

  9. 【填坑】bzoj3224 splay裸题

    人生第一道splay不出所料是一道裸题,一道水题,一道2k代码都不到的题 #include <cstdio> ,n,p,q; ],c[][],size[],sp[]; void rot(i ...

  10. .net开源后可以查看的源代码

    通过此网站可以直接查询基于.net framework4.6的源码 也可以下载到本地通过VS 查看.