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

效果图如下:

相关推荐
Young Doro8 小时前
独立性检测学习任务
人工智能·学习·数据挖掘
snakecy9 小时前
macOS 安装 LaTeX 全流程指南:从 MacTeX 到中文排版
macos·策略模式
终端安全笔记9 小时前
一份配置管十项 AI 功能:它关的是入口,不是数据
网络安全·ios·移动设备管理
卡卡~~10 小时前
“101计划”核心课程实践教材《数据实验结构指导-C++语言版》题目集
开发语言·c++·学习·算法
lengxuenong11 小时前
树状数组 · 信息学学习手册1-求和3个模板
c++·学习·算法·青少年编程
lanxiaoqing0211 小时前
演讲训练的第一步:先敢说,再会说
人工智能·学习·学习方法·口才
m4Rk_13 小时前
【论文阅读】Agent记忆机制(109):MemComposer——用强化学习学会选哪些记忆、选多少以及怎样排序
论文阅读·人工智能·学习·开源·github
zhangdaliangmvp13 小时前
快速排序的学习理解:从基础分治到三路划分优化
c++·学习·算法
叼烟扛炮13 小时前
Linux 学习笔记(四):文件检索与管道重定向
linux·笔记·学习
王夏奇14 小时前
AI工具学习
网络·学习