iOS-系统弹窗调用,

代码:

复制代码
UIAlertController *alertViewController = [UIAlertController alertControllerWithTitle:@"请选择方式" message:nil preferredStyle:UIAlertControllerStyleActionSheet];// style 为 sheet
UIAlertAction *cancle = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
UIAlertAction *picture = [UIAlertAction actionWithTitle:@"相册" style:UIAlertActionStyleDefault handler:nil];//handler里可以写需要的函数
UIAlertAction *photo = [UIAlertAction actionWithTitle:@"相机" style:UIAlertActionStyleDefault handler:nil];//同理
[alertViewController addAction:cancle];
[alertViewController addAction:photo];
[alertViewController addAction:picture];
[self presentViewController:alertViewController animated:YES completion:nil];

handle处理格式如下:

复制代码
UIAlertAction *picture = [UIAlertAction actionWithTitle:@"相册" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
    <#code#>
}];//handler里可以写需要的函数

效果图如下:

相关推荐
码荼2 小时前
学习开发之hashmap
java·python·学习·哈希算法·个人开发·小白学开发·不花钱不花时间crud
武昌库里写JAVA3 小时前
Oracle如何使用序列 Oracle序列使用教程
java·开发语言·spring boot·学习·课程设计
祁思妙想3 小时前
八股学习(三)---MySQL
数据库·学习·mysql
共享ui设计和前端开发人才4 小时前
UI前端大数据处理安全性保障:数据加密与隐私保护策略
ui
ui设计前端开发老司机4 小时前
UI前端大数据处理性能瓶颈突破:分布式计算框架的应用
ui
前端开发与ui设计的老司机4 小时前
UI前端与数字孪生结合实践探索:智慧物流的货物追踪与配送优化
前端·ui
amazinging4 小时前
北京-4年功能测试2年空窗-报培训班学测开-第四十一天
python·学习·appium
Jyywww1214 小时前
微信小程序学习笔记
笔记·学习·微信小程序
amazinging4 小时前
北京-4年功能测试2年空窗-报培训班学测开-第三十九天
python·学习·appium
每次的天空5 小时前
Android-自定义View的实战学习总结
android·学习·kotlin·音视频