打开系统默认相册功能

2020-04-23  本文已影响0人  Fade1992

UIImagePickerControllerDelegate

#pragma mark - 相册
- (void)openPhotoVC{

    //判断是否有相机权限
    PHAuthorizationStatus status = [PHPhotoLibrary authorizationStatus];
    if (status == PHAuthorizationStatusRestricted || status == PHAuthorizationStatusDenied) {
        //无权限
        [ccs showNotice:@"无相册访问权限"];
        return;
    }
    UIImagePickerController *pickerC = [[UIImagePickerController alloc]init];
    pickerC.delegate = self ;
    pickerC.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    pickerC.modalPresentationStyle = UIModalPresentationFullScreen;
    [self.viewController presentViewController:pickerC animated:YES completion:nil];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info{
//    获取图片
    UIImage *image = info[UIImagePickerControllerOriginalImage];

}
上一篇下一篇

猜你喜欢

热点阅读