行业知识
iOS-系统弹窗调用,
2026-11-06 13:29:52
来源:互联网转载
代���:
UIAlertController *alertViewController = [UIAlertController alertControllerWithTitle:@"请选择方式" message:nil preferredStyle:UIAlertControllerStyleActionSheet];// style 为 sheetUIAlertAction *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) { }];//handler里可以写需要的函数 效果图如下:
下一篇:金蝶很卡怎么清理服务器?