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

效果图如下:

相关推荐
Ceelog8 分钟前
MemoryBubble(内存泡泡) 戳泡泡清理 Mac 内存
macos·mac
好奇龙猫12 分钟前
【人工智能学习-AI-MIT公开课-第9.约束:视觉对象识别(視覚対象認識)】
学习
程序猿零零漆1 小时前
Spring之旅 - 记录学习 Spring 框架的过程和经验(八)基于Spring的注解应用
java·学习·spring
·present·1 小时前
射频网课学习第二章(阻抗匹配 ch2-5到ch2-9部分)
学习
航Hang*1 小时前
第五章:综合布线技术 —— 管理间(电信间)设计与施工
网络·笔记·学习·设计·光纤
以梦为马越骑越傻2 小时前
量化交易学习_23常用api
学习
·present·2 小时前
射频学习第九章网课学习(宽频放大器)
学习
2501_915921432 小时前
没有 iOS 源码的前提下如何进行应用混淆,源码混淆失效后的替代
android·ios·小程序·https·uni-app·iphone·webview
byzh_rc3 小时前
[机器学习-从入门到入土] 计算学习理论
人工智能·学习·机器学习
三品吉他手会点灯3 小时前
STM32F103 学习笔记-21-串口通信(第2节)-STM32串口功能框图讲解
笔记·stm32·单片机·嵌入式硬件·学习