有没有办法保留用户在照片应用程序中排列所有相册的顺序?我一整天都在尝试解决这个问题,但似乎无法找到如何保留顺序以在我的应用程序中显示的内容。
我想保留顺序是因为用户可以重新排列他们在照片应用程序中的相册,所以我希望我的用户界面匹配列表顺序。
我使用的代码来设置列表:
PHFetchResult *smartAlbumFetchResult = [PHAssetCollection fetchAssetCollectionsWithType:
PHAssetCollectionTypeSmartAlbum subtype:PHAssetCollectionSubtypeAny options:nil];
PHFetchResult *albumFetchResult = [PHAssetCollection fetchAssetCollectionsWithType:
PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeAny options:nil];
NSArray *collectionFetches = @[smartAlbumFetchResult, albumFetchResult];
NSMutableArray *albumArray = [NSMutableArray new];
for (PHFetchResult *newFetch in collectionFetches)
{
for (PHAssetCollection *sub in newFetch)
{
[albumArray addObject:sub];
// Other setup omitted
}
}