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

效果图如下:

相关推荐
灰灰勇闯IT34 分钟前
RN路由与状态管理:打造多页面应用
开发语言·学习·rn路由状态
思成不止于此2 小时前
【MySQL 零基础入门】DQL 核心语法(四):执行顺序与综合实战 + DCL 预告篇
数据库·笔记·学习·mysql
Nan_Shu_6143 小时前
学习:Vuex (1)
学习
GoogleDocs3 小时前
基于[api-football]数据学习示例
java·学习
李小星同志3 小时前
DPO,PPO,GRPO的学习
人工智能·深度学习·学习
如此风景3 小时前
iOS SwiftUI开发所有修饰符使用详解
ios
mumuWorld3 小时前
KSCrash 实现机制深度分析
ios·源码阅读
AskHarries4 小时前
Google 登录问题排查指南
flutter·ios·app
weixin_409383124 小时前
简单四方向a*寻路学习记录7 实现了多个障碍绕行但是绕路
学习
林夕sama4 小时前
MySQL的学习笔记
笔记·学习·mysql