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里可以写需要的函数

效果图如下:

相关推荐
恋猫de小郭18 分钟前
腾讯 Kuikly 正式开源,了解一下这个基于 Kotlin 的全平台框架
android·前端·ios
韩明君30 分钟前
前端学习笔记(四)自定义组件控制自己的css
前端·笔记·学习
noevil1 小时前
cuda学习1: 获取设备信息
学习
FAREWELL000751 小时前
C#进阶学习(十四)反射的概念以及关键类Type
开发语言·学习·c#·反射·type
隐-梵2 小时前
Android studio学习之路(八)---Fragment碎片化页面的使用
android·学习·android studio
百锦再2 小时前
Kotlin学习基础知识大全(上)
android·xml·学习·微信·kotlin·studio·mobile
灏瀚星空2 小时前
从基础到实战的量化交易全流程学习:1.1 量化交易本质与行业生态
人工智能·笔记·学习·数学建模·信息可视化
FAREWELL000752 小时前
C#进阶学习(十三)C#中的预处理器指令
开发语言·学习·c#·预处理指令
超人强2 小时前
一文搞定App启动流程、时间监测、优化措施
ios
xiaohanbao092 小时前
day6 python数据可视化
python·学习·信息可视化·pandas