// // NSObject+AlbumItem.m // gengmei_flutter_plugin // // Created by Apple on 2019/9/9. // #import "AlbumItem.h" @implementation AlbumItem -(void)setCollection:(PHAssetCollection *)collection { _collection = collection; // if ([collection.localizedTitle isEqualToString:@"All Photos"]||[collection.localizedTitle isEqualToString:@"所有照片"]) { // self.collectionTitle = @"IsGengmeiAlbumAllImages"; // } else { // // } self.collectionTitle = collection.localizedTitle; // self.collectionTitle = collection.localizedTitle; PHFetchOptions *fetchOptions = [[PHFetchOptions alloc]init]; fetchOptions.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:NO]]; // NSSortDescriptor *sort = [NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:NO]; // 获得某个相簿中的所有PHAsset对象 self.assets = [PHAsset fetchAssetsInAssetCollection:collection options:fetchOptions]; if (self.assets.count > 0) { self.firstAsset = self.assets[0]; } self.collectionNumber = self.assets.count; } #pragma mark - Get方法 -(NSMutableArray<NSNumber *> *)selectRows { if (!_selectRows) { _selectRows = [NSMutableArray array]; } return _selectRows; } @end