klc*_*r89 8 objective-c ios photosframework photokit
有没有办法保留用户在照片应用中排列所有相册的列表顺序?我一直在努力解决这个问题,而且我似乎无法弄清楚我缺少什么来保留在我的应用程序中显示的顺序.
我想保留订单,因为用户可以在照片应用中重新排列他们的相册,所以我希望我的UI与列表顺序相匹配.
代码我用来设置列表:
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
}
}
Run Code Online (Sandbox Code Playgroud)
抱歉,但我认为这实际上是不可能的(我希望有一些升级)。
实际上,可以使用 PHFetchOptions 对资产集合进行排序,但 PhotoKit 仅支持 predicate 和 sortDescriptors 属性的一组受限键(请参阅PHFetchOptions),在这些键之间,我看不到用户的列表顺序键已安排在照片应用程序中。
| 归档时间: |
|
| 查看次数: |
681 次 |
| 最近记录: |