Latest 2.2.4
Homepage https://github.com/RITL/RITLImagePickerDemo
License MIT
Platforms ios 8.0, requires ARC
Dependencies RITLKit, Masonry
Frameworks Foundation, UIKit, Photos, PhotosUI
Authors

2018-05-18更新

依赖的库

pod 'RITLKit'
pod 'Masonry'

CocoaPod

pod 'RITLPhotos'
#import <RITLPhotos/RITLPhotos.h>

使用方法

RITLPhotosViewController *photoController = RITLPhotosViewController.photosViewController;
photoController.configuration.maxCount = 5;//最大的选择数目
photoController.configuration.containVideo = false;//选择类型,目前只选择图片不选择视频

photoController.photo_delegate = self;
photoController.thumbnailSize = self.assetSize;//缩略图的尺寸
photoController.defaultIdentifers = self.saveAssetIds;//记录已经选择过的资源

[self presentViewController:photoController animated:true completion:^{}];

回调方法

#pragma mark - RITLPhotosViewControllerDelegate
/**** 为了提高相关性能,如果用不到的代理方法,不需要多实现  ****/

/// 图片选择器消失的回调方法
- (void)photosViewControllerWillDismiss:(UIViewController *)viewController {
    NSLog(@"%@ is dismiss",viewController);
}

/**
 选中图片以及视频等资源的本地identifer
 可用于设置默认选好的资源

 @param viewController RITLPhotosViewController
 @param identifiers 选中资源的本地标志位
 */
- (void)photosViewController:(UIViewController *)viewController
            assetIdentifiers:(NSArray <NSString *> *)identifiers
{

}
/**
 选中图片以及视频等资源的默认缩略图
 根据thumbnailSize设置所得,如果thumbnailSize为.Zero,则不进行回调
 与是否原图无关

 @param viewController RITLPhotosViewController
 @param thumbnailImages 选中资源的缩略图
 @param infos 选中资源的缩略图的相关信息
 */
- (void)photosViewController:(UIViewController *)viewController thumbnailImages:(NSArray<UIImage *> *)thumbnailImages infos:(NSArray<NSDictionary *> *)infos
{
    self.assets = thumbnailImages;
    [self.collectionView reloadData];

    NSLog(@"%@",infos);
}
/**
 选中图片以及视频等资源的原比例图片
 适用于不使用缩略图,或者展示高清图片
 与是否原图无关

 @param viewController RITLPhotosViewController
 @param images 选中资源的原比例图
 @param infos 选中资源的原比例图的相关信息
 */
- (void)photosViewController:(UIViewController *)viewController images:(NSArray<UIImage *> *)images infos:(NSArray<NSDictionary *> *)infos
{
    //获得原比例的图片
}
/**
 选中图片以及视频等资源的数据
 根据是否选中原图所得
 如果为原图,则返回原图大小的数据
 如果不是原图,则返回原始比例的数据
 注: 不会返回thumbnailImages的数据大小

 @param viewController RITLPhotosViewController
 @param datas 选中资源的数据
 */
- (void)photosViewController:(UIViewController *)viewController
                       datas:(NSArray <NSData *> *)datas
{

}
/**
 选中图片以及视频等资源的源资源对象
 如果需要使用源资源对象进行相关操作,请实现该方法

 @param viewController RITLPhotosViewController
 @param assets 选中的源资源
 */
- (void)photosViewController:(UIViewController *)viewController
                      assets:(NSArray <PHAsset *> *)assets
{

}

更新日志

  • 2018-11-05 修复datas回调返回数据永远为空数组问题,新增代理- (void)photosViewControllerWillDismiss:(UIViewController *)viewController;
  • 2018-07-10 修复部分icloud图片获得失败的问题
  • 2018-06-26 修复部分系统加载bundle图片失败的问题
  • 2018-06-15 修复拒绝权限崩溃的问题
  • 2018-05-21 使用defaultIdentifers属性可以记录选中的资源,可通过代理回调获得,支持Pod
  • 2018-05-18 Version 2.0 增加了图片多选库中对Live以及Video的支持,增加了对顺序获取图片的支持
  • 2017-11-30 去除必须使用的Objective-C++模式,新增代理方法替代Block
  • 2017-05-19 Version 1.0
  • 2016-09-24 支持3D Touch
  • 2016-04-05 Version 0.1

待办清单

  • [ ] 支持拓展性的视图文字以及边框主题色
  • [x] 支持图片按点击顺序排列
  • [ ] 支持拖动进行的排序
  • [x] 支持CocoaPod
  • [x] 支持3D Touch响应
  • [x] 支持原图返回数据内存监控问题
  • [ ] 支持图片编辑功能
  • [ ] 支持图片裁剪功能
  • [ ] 支持相册变化的监听回调功能
  • [ ] 支持下滑返回手势功能

之前版本

  • 请前往version1.0分支获得之前版本的代码以及README.md

Latest podspec

{
    "name": "RITLPhotos",
    "version": "2.2.4",
    "summary": "PhotosPicker",
    "description": "u4e00u4e2au57fau4e8ePhotos.frameworku7684u56feu7247u591au9009uff0cu6a21u4effu5faeu4fe1uff0cu8fd8u6709u5f88u591au4e0du8db3uff0cu6b63u5728u6539u8fdbu548cu4f18u5316.",
    "homepage": "https://github.com/RITL/RITLImagePickerDemo",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "YueXiaoWen": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/RITL/RITLImagePickerDemo.git",
        "tag": "2.2.4"
    },
    "source_files": "RITLPhotos/RITLPhotos.h",
    "frameworks": [
        "Foundation",
        "UIKit",
        "Photos",
        "PhotosUI"
    ],
    "requires_arc": true,
    "resources": "RITLPhotos/Resource/RITLPhotos.bundle",
    "dependencies": {
        "RITLKit": [],
        "Masonry": []
    },
    "subspecs": [
        {
            "name": "RITLConfig",
            "source_files": "RITLPhotos/RITLConfig/*.{h,m}"
        },
        {
            "name": "Protocol",
            "source_files": "RITLPhotos/Protocol/*.{h,m}"
        },
        {
            "name": "RITLPhotosCategory",
            "source_files": "RITLPhotos/RITLPhotosCategory/*.{h,m}"
        },
        {
            "name": "RITLViews",
            "source_files": "RITLPhotos/RITLViews/*.{h,m}",
            "dependencies": {
                "RITLPhotos/RITLPhotosCategory": []
            }
        },
        {
            "name": "RITLData",
            "source_files": "RITLPhotos/RITLData/*.{h,m}",
            "dependencies": {
                "RITLPhotos/RITLPhotosCategory": [],
                "RITLPhotos/Protocol": []
            }
        },
        {
            "name": "RITLPhotoStore",
            "source_files": "RITLPhotos/RITLPhotoStore/*.{h,m}",
            "dependencies": {
                "RITLPhotos/RITLPhotosCategory": []
            }
        },
        {
            "name": "RITLGroupModule",
            "source_files": "RITLPhotos/RITLGroupModule/*.{h,m}",
            "dependencies": {
                "RITLPhotos/RITLPhotosCategory": [],
                "RITLPhotos/RITLCollectionModule": [],
                "RITLPhotos/RITLPhotoStore": []
            }
        },
        {
            "name": "RITLCollectionModule",
            "source_files": "RITLPhotos/RITLCollectionModule/*.{h,m}",
            "dependencies": {
                "RITLPhotos/RITLPhotosCategory": [],
                "RITLPhotos/RITLHoriScrollModule": [],
                "RITLPhotos/RITLConfig": [],
                "RITLPhotos/RITLData": [],
                "RITLPhotos/RITLViews": [],
                "RITLPhotos/RITLPhotoStore": []
            }
        },
        {
            "name": "RITLPhotosController",
            "source_files": "RITLPhotos/RITLPhotosController/*.{h,m}",
            "dependencies": {
                "RITLPhotos/RITLConfig": [],
                "RITLPhotos/Protocol": [],
                "RITLPhotos/RITLData": [],
                "RITLPhotos/RITLGroupModule": [],
                "RITLPhotos/RITLCollectionModule": []
            }
        },
        {
            "name": "RITLHoriScrollModule",
            "source_files": "RITLPhotos/RITLHoriScrollModule/*.{h,m}",
            "dependencies": {
                "RITLPhotos/RITLPhotosCategory": [],
                "RITLPhotos/RITLConfig": [],
                "RITLPhotos/RITLData": [],
                "RITLPhotos/RITLViews": []
            }
        }
    ]
}

Pin It on Pinterest

Share This