Latest 1.3.0
Homepage https://github.com/ws00801526/XMNPhoto
License MIT
Platforms ios 8.0
Authors

XMNPhotoPickerKit

一款图片,视频选择类库


相关bug修复

v1.1.0
  1. 工程结构改变
  2. 增加pod 使用方法
  3. pod 'XMNPhoto' 默认Picker,Browser
  4. 单独使用
    • 单独使用picker pod 'XMNPhoto/Picker'
    • 单独使用Browser pod 'XMNPhoto/Browser'
V1.0.4
  1. 增加了一个基于YYWebImage框架封装的图片浏览器 XMNPhotoBrowser — 强烈推荐学习下ibireme大神的其他框架
  2. 修复iOS8以下崩溃bug
  3. 去除获取图片时,图片按照创建时间排序的功能
  4. 增加了类似QQ手势拖动发送图片功能
  5. 2016-07-14 修复pickingVideoEnable属性 区分是否选择图片,或者视频
  6. 修复选择视频时 谓词过滤崩溃bug 感谢suyongmaozhao
V1.0.3
  1. 修复了首次提示授权选择后 页面不更新问题
  2. 去除了拖动发送功能
  3. 增加了类似QQ的选择stick功能
V1.0.2
  1. 修复XMNPhotoPicker 选择最大数量提示不正确
V1.0.1
  1. 修复pods引用后没有找到xib文件
V1.0.0
  1. 修复自定义导航栏导致底部bottomBar位置不正确问题

1. 预览

最新V1.0.4版本
图片浏览器

2. 功能

  • 一款图片,视频选择类库
  • 支持直接显示相册选择
  • 支持类似QQ方式Sheet选择
  • iOS8+支持动态监测PhotoLibrary变化
  • 支持预览图片,预览视频

3. 使用方法

  • . pods使用
    pod ‘XMNPhotoPickerFramework’

  • . 直接引用

    1. 命令行下 git clone https://github.com/ws00801526/ XMNPhotoPickerFramework.git
    2. 拖动XMNPhotoPickerFramework 到你的工程内
    3. 导入头文件XMNPhotoPickerFramework.h 即可
    4. 具体用法,请参考demo

3.1 直接显示相册

- (void)_showPhotoPickerC {
    //1.初始化一个XMNPhotoPickerController
    XMNPhotoPickerController *photoPickerC = [[XMNPhotoPickerController alloc] initWithMaxCount:9 delegate:nil];
    //3.取消注释下面代码,使用代理方式回调,代理方法参考XMNPhotoPickerControllerDelegate
//    photoPickerC.photoPickerDelegate = self;

    //3..设置选择完照片的block 回调
    __weak typeof(*&self) wSelf = self;
    [photoPickerC setDidFinishPickingPhotosBlock:^(NSArray<UIImage *> *images, NSArray<XMNAssetModel *> *assets) {
        __weak typeof(*&self) self = wSelf;
        NSLog(@"picker images :%@ nn assets:%@",images,assets);

                //!!!如果需要自定义大小的图片 使用下面方法
//        [[XMNPhotoManager sharedManager] getThumbnailWithAsset:<# asset in assets #> size:<# your size #> completionBlock:^(UIImage * _Nullable image) {
//            
//        }];

        self.assets = [assets copy];
        [self.collectionView reloadData];
        //XMNPhotoPickerController 确定选择,并不会自己dismiss掉,需要自己dismiss
        [self dismissViewControllerAnimated:YES completion:nil];
    }];

    //4.设置选择完视频的block回调
    [photoPickerC setDidFinishPickingVideoBlock:^(UIImage *coverImage, XMNAssetModel * asset) {
        __weak typeof(*&self) self = wSelf;
        NSLog(@"picker image :%@nn asset:%@nn",coverImage,asset);
        self.assets = @[asset];
        [self.collectionView reloadData];
        //XMNPhotoPickerController 确定选择,并不会自己dismiss掉,需要自己dismiss
        [self dismissViewControllerAnimated:YES completion:nil];
    }];

    //5.设置用户取消选择的回调 可选
    [photoPickerC setDidCancelPickingBlock:^{
        NSLog(@"photoPickerC did Cancel");
        //此处不需要自己dismiss
    }];

    //6. 显示photoPickerC
    [self presentViewController:photoPickerC animated:YES completion:nil];
}

3.2 显示XMNPhotoPicker

- (void)_showPhotoPicker {
    //1. 推荐使用XMNPhotoPicker 的单例
    //2. 设置选择完照片的block回调
    [[XMNPhotoPicker sharePhotoPicker] setDidFinishPickingPhotosBlock:^(NSArray<UIImage *> *images, NSArray<XMNAssetModel *> *assets) {
        NSLog(@"picker images :%@ nn assets:%@",images,assets);
        self.assets = [assets copy];
        [self.collectionView reloadData];
    }];
    //3. 设置选择完视频的block回调
    [[XMNPhotoPicker sharePhotoPicker] setDidFinishPickingVideoBlock:^(UIImage * image, XMNAssetModel *asset) {
        NSLog(@"picker video :%@ nn asset :%@",image,asset);
        self.assets = @[asset];
        [self.collectionView reloadData];
    }];
    //4. 显示XMNPhotoPicker
    [[XMNPhotoPicker sharePhotoPicker] showPhotoPickerwithController:self animated:YES];
}

4.相关类说明 : 传送门

5. 感谢

感谢 GitHub:banchichen

Latest podspec

{
    "name": "XMNPhoto",
    "version": "1.3.0",
    "summary": "XMNPhoto u56feu7247u76f8u5173u96c6u5408u5de5u5177u5305u542bu56feu7247u9009u62e9u5217u5e93, u57fau4e8eYYWebImageu5c01u88c5u7684u4e00u6b3eu7b80u5355u7684u56feu7247u6d4fu89c8u7c7bu5e93",
    "homepage": "https://github.com/ws00801526/XMNPhoto",
    "screenshots": [
        "https://camo.githubusercontent.com/711c2776179af97c37ce0dda617642f45f55449b/687474703a2f2f37786c74316a2e636f6d312e7a302e676c622e636c6f7564646e2e636f6d2f584d4e50686f746f5069636b65724672616d65776f726b2e676966",
        "https://camo.githubusercontent.com/8a60aa309935ccf57bc141fe12021f8f892ef387/687474703a2f2f37786c74316a2e636f6d312e7a302e676c622e636c6f7564646e2e636f6d2f584d4e50686f746f5069636b65724672616d65776f726b5f42726f777365722e676966"
    ],
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "XMFraker": "[email protected]"
    },
    "source": {
        "git": "https://github.com/ws00801526/XMNPhoto.git",
        "tag": "1.3.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "default_subspecs": [
        "Picker",
        "Browser"
    ],
    "subspecs": [
        {
            "name": "Picker",
            "source_files": [
                "XMNPhoto/Classes/XMNPhotoPicker/*.{h,m}",
                "XMNPhoto/Classes/XMNPhotoPicker/**/*.{h,m}"
            ],
            "resource_bundles": {
                "XMNPhotoPicker": [
                    "XMNPhoto/Assets/XMNPhotoPicker/*.png",
                    "XMNPhoto/Assets/XMNPhotoPicker/*.xib"
                ]
            },
            "dependencies": {
                "YYImage": []
            }
        },
        {
            "name": "Browser",
            "source_files": [
                "XMNPhoto/Classes/XMNPhotoBrowser/*.{h,m}",
                "XMNPhoto/Classes/XMNPhotoBrowser/**/*.{h,m}"
            ],
            "dependencies": {
                "YYWebImage": []
            }
        }
    ]
}

Pin It on Pinterest

Share This