【问题标题】:Custom Image Picker for iOS适用于 iOS 的自定义图像选择器
【发布时间】:2014-03-26 09:04:57
【问题描述】:

我的应用中有自己的 collectionView。我不想为我的应用程序使用默认的 UIImagePicker,我想用我的集合视图实现 Image Picker。

谁能告诉我如何实现自定义选择相册视图,选择相册后,如何实现自定义视图以查看该相册中的所有图像。

抱歉,这个问题很简单。

【问题讨论】:

标签: ios iphone custom-controls uicollectionview uiimagepickercontroller


【解决方案1】:

这可以在 ALASSETS 的帮助下完成。您可以在下面找到有关它的文档。 https://developer.apple.com/library/ios/documentation/AssetsLibrary/Reference/ALAsset_Class

ALAssetsLibrary *al = [[ALAssetsLibrary alloc] init];
assets = [[NSMutableArray alloc] init];
[al enumerateGroupsWithTypes:ALAssetsGroupAll

                  usingBlock:^(ALAssetsGroup *group, BOOL *stop)
 {
     [group enumerateAssetsUsingBlock:^(ALAsset *asset, NSUInteger index, BOOL *stop)
      {
          if (asset)
          {  
               NSLog(@"%@",asset);  

              NSLog(@".. do something with the asset");    
          }
      }
      ];
 }

                         failureBlock:^(NSError *error)
      {
          // User did not allow access to library
         // .. handle error 
      }
      ] ;

如果要将其填充到集合视图中,您需要创建一个具有 Alasset 类型变量的自定义单元格

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-15
    相关资源
    最近更新 更多