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

效果图如下:

相关推荐
2501_918126914 小时前
stm32做一个次声波检测器,需要哪些元件
stm32·单片机·嵌入式硬件·学习·个人开发
GocNeverGiveUp5 小时前
大模型学习2-Agent
学习
Bal炎魔5 小时前
AI 学习专题一,AI 实现的原理
人工智能·学习
Ro Jace6 小时前
分岔机制学习
人工智能·学习·机器学习
反向跟单策略7 小时前
期货反向跟单-2025年回顾及2026年展望
大数据·人工智能·学习·数据分析·区块链
yunhuibin7 小时前
GoogLeNet学习
人工智能·python·深度学习·神经网络·学习
iOS阿玮7 小时前
百款出海社交 App 一夜下架!2026,匿名社交的生死劫怎么破?
uni-app·app·apple
xcLeigh8 小时前
Python入门:Python3 正则表达式全面学习教程
python·学习·正则表达式·教程·python3
知识分享小能手8 小时前
PostgreSQL 入门学习教程,从入门到精通,PostgreSQL 16 语法知识点与案例详解(1)
数据库·学习·postgresql
代码游侠8 小时前
Linux驱动复习——驱动
linux·运维·arm开发·笔记·学习