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

效果图如下:

相关推荐
递归不收敛12 分钟前
吴恩达机器学习课程(PyTorch 适配)学习笔记:3.4 强化学习
pytorch·学习·机器学习
StarPrayers.15 分钟前
卷积层(Convolutional Layer)学习笔记
人工智能·笔记·深度学习·学习·机器学习
能不能别报错41 分钟前
K8s学习笔记(十五) pause容器与init容器
笔记·学习·kubernetes
ᖰ・◡・ᖳ1 小时前
JavaScript:神奇的ES6之旅
前端·javascript·学习·es6
小马学嵌入式~1 小时前
堆排序原理与实现详解
开发语言·数据结构·学习·算法
递归不收敛2 小时前
吴恩达机器学习课程(PyTorch适配)学习笔记:1.4 模型评估与问题解决
pytorch·学习·机器学习
又是忙碌的一天2 小时前
前端学习 JavaScript
前端·javascript·学习
ooo-p2 小时前
FPGA学习篇——Verilog学习之计数器的实现
学习·fpga开发
A9better2 小时前
嵌入式开发学习日志37——stm32之USART
stm32·嵌入式硬件·学习
zhangrelay2 小时前
ROS云课三分钟-使用动态参数重配置调试Teb导航案例-251008
笔记·学习