UIAlertController
UIAlertController *alertSheet = [UIAlertController alertControllerWithTitle:@"请您选择上传的图片" message:nil preferredStyle:UIAlertControllerStyleActionSheet];
[alertSheet addAction:[UIAlertAction actionWithTitle:@"拍照" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[self cameraButtonClickedPersonVC];
}]];
[alertSheet addAction:[UIAlertAction actionWithTitle:@"相册" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[self pickImageFromAlbumPersonVC];
}]];
[alertSheet addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
}]];
//iPad不加下面两句,使用UIAlertAction 会crash
alertSheet.popoverPresentationController.sourceView = self.view;
alertSheet.popoverPresentationController.sourceRect = CGRectMake(0, 0, 1.0, 1.0);
[self presentViewController:alertSheet animated:YES completion:nil];
效果就如上图所示,具体位置根据项目需求来设置。