美文网首页
打开系统默认相册功能

打开系统默认相册功能

作者: Fade1992 | 来源:发表于2020-04-23 10:42 被阅读0次
    
    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];
    }
    
    • delegate
    - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info{
    //    获取图片
        UIImage *image = info[UIImagePickerControllerOriginalImage];
    
    }
    

    相关文章

      网友评论

          本文标题:打开系统默认相册功能

          本文链接:https://www.haomeiwen.com/subject/yjmiihtx.html