#pragma mark - 相册的代理
-(void)photoLibraryDidChange:(PHChange *)changeInstance
{
dispatch_async(dispatch_get_main_queue(), ^{
PHObjectChangeDetails* isChange = [changeInstance changeDetailsForObject:_SelectCollection];
if (isChange) {
_AllAssets = [PHAsset fetchAssetsInAssetCollection:_SelectCollection options:nil];
[self.collectionView reloadData];
}
});
}
#pragma mark - 拍照处理
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info
{
NSString* mediaType = [info objectForKey:UIImagePickerControllerMediaType];
//判断是静态图像还是视频
if ([mediaType isEqualToString:(NSString *)kUTTypeImage]) {
//相册是否支持添加图片
if ([_SelectCollection canPerformEditOperation:PHCollectionEditOperationAddContent]) {
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
//获取用户编辑之后的图像
[x-Code7新功能之三]PHPhotoLibrary的练习
最新推荐文章于 2021-03-26 09:11:16 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)