UI控件(UIAlertController)
@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)的更多相关文章
- Swift UI控件详细介绍(上)
UI控件 首先介绍一下AppDelegate.swift@UIApplicationMain 调用了OC中的UIApplicationMain函数:UIApplicationMain是iOS应用程序的 ...
- iOS基础UI控件介绍-Swift版
iOS基础UI控件总结 iOS基础控件包括以下几类: 1.继承自NSObject:(暂列为控件) UIColor //颜色 UIImage //图像 2.继承自UIView: 只能相应手势UIGest ...
- ANDROID L——Material Design详解(UI控件)
转载请注明本文出自大苞米的博客(http://blog.csdn.net/a396901990),谢谢支持! Android L: Google已经确认Android L就是Android Lolli ...
- WinForm/Silverlight多线程编程中如何更新UI控件的值
单线程的winfom程序中,设置一个控件的值是很easy的事情,直接 this.TextBox1.value = "Hello World!";就搞定了,但是如果在一个新线程中这么 ...
- 富客户端 wpf, Winform 多线程更新UI控件
前言 在富客户端的app中,如果在主线程中运行一些长时间的任务,那么应用程序的UI就不能正常相应.因为主线程要负责消息循环,相应鼠标等事件还有展现UI. 因此我们可以开启一个线程来格外处理需要长时间的 ...
- UI控件(复习一下)
如何修改控件状态• 可见,确实需要经常修改控件状态• 那如何去修改控件的状态呢?方法很简单➢ 每一个UI控件都是一个对象➢ 修改UI控件的状态,其实就是修改控件对象的属性➢ 比如修改UILabel显示 ...
- IOS学习资源收集--开发UI控件相关
收集的一些本人了解过的iOS开发UI控件相关的代码资源(本文持续补充更新) 内容大纲: 1.本人在github上也上传了我分装好的一些可重复利用的UI控件 2.计时相关的自定义UILabel控件 正文 ...
- 《深入理解Windows Phone 8.1 UI控件编程》基于最新的Runtime框架
<深入理解Windows Phone 8.1 UI控件编程>本书基于最新的Windows Phone 8.1 Runtime SDK编写,全面深入地论述了最酷的UI编程技术:实现复杂炫酷的 ...
- AppleWatch___学习笔记(二)UI布局和UI控件
1.UI布局 直接开发,你会发现Apple Watch并不支持AutoLayout,WatchKit里有个类叫做WKInterfaceGroup,乍一看像是UIView,但是这货其实是用来布局的.从 ...
- (转).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 ...
随机推荐
- Duilib源码分析(四)绘制管理器—CPaintManagerUI—(前期准备二)
接下来,我们继续分析UIlib.h文件中余下的文件,当然部分文件可能顺序错开分析,这样便于从简单到复杂的整个过程的里面,而避免一开始就出现各种不理解的地方. 1. UIManager.h:UI管理器, ...
- Datazen笔记索引
Datazen介绍 http://www.cnblogs.com/aspnetx/p/4557547.html Datazen安装 http://www.cnblogs.com/aspnetx ...
- 第五篇:在SOUI中使用XML布局属性指引(pos, offset, pos2type)
窗口布局的概念 每一个UI都是由大量的界面元素构成的,在Windows编程,这些界面元素的最小单位通常称之为控件. 布局就是这些控件在主界面上的大小及相对位置. 传统的布局一般使用一个4个绝对坐标来定 ...
- java web系统中时间比sql server中的日期少2天的解决办法
系统环境 jdk:1.7 数据库:sql server 2008 问题描述 升级1.7之后查询出来的日期就比数据库中的少2天,降回1.6版本的jdk就正常了. 问题原因及解决办法 国内网站有很多不靠谱 ...
- 开发常用技巧之css字体编码
简介: 当我们写css时,通常需要设置字体名称,我们可以直接写中文,这样没错,但是文件编码为GB2312.UTF-8等不匹配将会出现乱码.因此将中文字体名称转为unicode编码来避免出现这些错误. ...
- 《DSP using MATLAB》示例Example6.1
今天是2016年最后一天了,看到其他博友都写年终总结,做了这个,做了那个,收获满满,再看看自己, 恍恍惚惚一年,不知道干了些什么,惭愧.刚才接到老妈远方的电话,弟弟就在一小时前做爸爸了,我在 这里祝福 ...
- HDU5909 Tree Cutting(树形DP + FWT)
题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=5909 Description Byteasar has a tree T with n ve ...
- 【HDU2222】Keywords Search AC自动机
[HDU2222]Keywords Search Problem Description In the modern time, Search engine came into the life of ...
- Leetcode Maximum Product Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest ...
- sort命令
1.默认情况下,sort命令,以字母序进行文本排序sort word.txt2.如果想对数字进行排序,可以使用-n参数sort num.txt -n3指定列排序下面是对passwd文件,以冒号(:)进 ...