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

效果图如下:

相关推荐
ZhiqianXia40 分钟前
gem5 模拟器学习笔记(1):核心术语整理
笔记·学习
GHL2842710901 小时前
MCP学习
学习·ai
凌波粒2 小时前
D2L学习笔记:安装、张量与数据处理
笔记·python·学习·pandas
chools2 小时前
Java后端拥抱AI开发之个人学习路线 - - Spring AI【第一期】
java·人工智能·学习·spring·ai
疯狂的程序猴3 小时前
iOS 多技术栈混淆实现,跨平台 App 混淆拆解与组合
后端·ios
忙什么果3 小时前
transformer学习笔记2
笔记·学习·transformer
ZhiqianXia3 小时前
Gem5 学习笔记(2) : Gem5 建模要点与基本思路
笔记·学习
Dxy12393102164 小时前
ECharts折线图入门学习:从基础到实战的完整指南
学习·信息可视化·echarts
_李小白4 小时前
【OSG学习笔记】Day 25: OSG 设计架构解析
笔记·学习·架构
风中的小熊生气4 小时前
MQ 学习笔记
笔记·学习