ios11调用系用相册崩溃

来源:互联网 发布:java给qq邮箱发邮件 编辑:程序博客网 时间:2024/06/05 04:57

AlertVC的弹出样式设置为alert,之前设置成了actionsheet(这种情况下还要设置frame,横竖屏,比较繁琐,但不设置的话崩溃)



- (void)changePhotoImg {

    UIAlertController * sheetController = [UIAlertController alertControllerWithTitle:@"请选择照片"
                                                                              message:nil preferredStyle:UIAlertControllerStyleAlert];
    UIAlertAction * Cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil];
    
    UIAlertAction * Done = [UIAlertAction actionWithTitle:@"拍照" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        
        [self selectImageSourceType:UIImagePickerControllerSourceTypeCamera];
    }];
    
    UIAlertAction * Destructive = [UIAlertAction actionWithTitle:@"从相册选择头像" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        
        [self selectImageSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
    }];
    
    [sheetController addAction:Cancel];
    [sheetController addAction:Done];
    [sheetController addAction:Destructive];
    [self presentViewController:sheetController animated:YES completion:nil];
}

阅读全文
0 0
原创粉丝点击