-4

我想显示在特定日期创建的图库中的所有图像。可以吗?

4

1 回答 1

0
-(void)loadImagelist{
  void (^assetEnumerator)(ALAsset *, NSUInteger, BOOL *) = ^(ALAsset *theAsset, NSUInteger index, BOOL *stop) {
    if(theAsset != NULL) {
      NSString *date = [theAsset valueForProperty: ALAssetPropertyDate];
      //if date == xxx add to list
    }
  };

  void (^assetGroupEnumerator)(ALAssetsGroup *, BOOL *) =  ^(ALAssetsGroup *group, BOOL *stop) {
      if(group != nil) {
        [group setAssetsFilter:[ALAssetsFilter allPhotos]];
        [group enumerateAssetsUsingBlock:assetEnumerator];
    }
  };

  ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
  [library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:assetGroupEnumerator failureBlock: ^(NSError *error) {
      NSLog(@"Failure");
  }];
}
于 2012-12-27T10:11:12.877 回答