UIAlertController使用
来源:互联网 发布:淘宝皇冠店铺100强 编辑:程序博客网 时间:2024/05/18 05:40
//// ViewController.m//#import "ViewController.h"@interface ViewController ()@end@implementation ViewController- (void)viewDidLoad { [super viewDidLoad]; [_alertButton addTarget:self action:@selector(addAlertVC) forControlEvents:UIControlEventTouchUpInside];}-(void)addAlertVC{ /* UIAlertActionStyleDefault = 0,默认样式 UIAlertActionStyleCancel, 取消操作,保留原先样子 UIAlertActionStyleDestructive 可能有删除、改变数据 */ /* UIAlertControllerStyleActionSheet = 0,下方弹出 UIAlertControllerStyleAlert 弹框 */ UIAlertController * alert = [UIAlertController alertControllerWithTitle:@"选择分享的平台" message:@"" preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction * alertAction1 = [UIAlertAction actionWithTitle:@"新浪" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { NSLog(@"新浪"); }]; UIAlertAction * alertAction2 = [UIAlertAction actionWithTitle:@"微信" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { NSLog(@"微信"); }]; UIAlertAction * alertAction3 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { NSLog(@"取消"); }]; [alert addAction:alertAction1]; [alert addAction:alertAction2]; [alert addAction:alertAction3]; [self presentViewController:alert animated:true completion:nil];}@end
效果图展示
阅读全文
0 0
- UIAlertController使用
- UIAlertController 使用
- UIAlertController使用
- UIAlertController使用
- UIAlertController使用
- UIAlertController使用
- UIAlertController使用
- UIAlertController使用
- UIAlertController的使用(Swift)
- UIAlertController的使用示例
- UIAlertController的使用二
- UIAlertController的使用
- UIAlertController的使用
- 关于UIAlertController的使用
- UIAlertController的使用
- UIAlertController 的使用
- UIAlertController 的使用
- UIAlertController的使用
- redis操作相关
- centos 查看版本的多种方法
- ppt模板网站
- 初窥nodejs(四) ——express框架
- try catch finally的运行顺序
- UIAlertController使用
- 如何从TensorFlow的mnist数据集导出手写体数字图片
- eclipse报错:发现了以元素 'd:skin' 开头的无效内容。此处不应含有子元素 Console报错: sdk\system-images\android-22\android-wear\ar
- Qt 从入门到精通
- Python编程:从入门到实践(课后习题6)
- 详解安全漏洞的定义以及分类
- 计算机网络五层协议的体系结构各层的主要功能
- Python编程:从入门到实践(课后习题7)
- Gradle多环境多渠道打包