我想在我的应用程序中更改albumName。
if ([collection canPerformEditOperation:PHCollectionEditOperationRename] == YES)
{
//rename localizedTitle
}如果是"YES",我想更改名称。
我的代码是:
PHFetchOptions *userAlbumsOptions = [PHFetchOptions new];
userAlbumsOptions.predicate = [NSPredicate predicateWithFormat:@"estimatedAssetCount > 0"];
PHFetchResult *userAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeAny options:userAlbumsOptions];
[userAlbums enumerateObjectsUsingBlock:^(PHAssetCollection *collection, NSUInteger idx, BOOL *stop)
{
}];发布于 2015-11-25 13:58:33
-(void)changeAlbumtitle:(PHAssetCollection *)collection withTitle:(NSString *)title {
if (![collection canPerformEditOperation:PHCollectionEditOperationRename]) {
NSLog(@"can't PerformEditOperation");
return;
}
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
PHAssetCollectionChangeRequest *changeTitlerequest =[PHAssetCollectionChangeRequest changeRequestForAssetCollection:collection];
changeTitlerequest.title = title;
} completionHandler:^(BOOL success, NSError *error) {
NSLog(@"Finished editing collection. %@", (success ? @"Successfully." : error));
}];
}在上面的给定函数中,传递专辑对象(PHAssetCollection )和标题
rename editOperation
https://stackoverflow.com/questions/31239513
复制相似问题