Latest 1.0
Homepage https://github.com/lovisty/YFPhotoAlbum
License MIT
Platforms ios 7.0, requires ARC
Frameworks UIKit, Photos, AssetsLibrary
Authors

CI Status
Version
License
Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

iOS7+

ScreenShot

下拉式相册分组       相册展示

照片大图预览

Installation

  • 通过CocoaPods安装  

YFPhotoAlbum 支持通过 CocoaPods进行安装。
在Podfile文件中加上

pod "YFPhotoAlbum"
  • 直接加项目中使用
    git clone https://github.com/lovisty/YFPhotoAlbum   

    找到包含的文件Classes和Assets的YFPhotoAlbum文件,直接把YFPhotoAlbum拖到项目中。

导入头文件:

#import "YFCustomPhotoAlbumViewController.h"  

Usage

初始化以及相关回调

self.photoAlbumViewController = [[BHCustomPhotoAlbumViewController alloc] init];
self.photoAlbumViewController.maxCount = 9;// maxCount > 0, 默认是 1.
self.photoAlbumViewController.selectedAssets = self.selectedAssets;//再次进入相册选择的时候,保留已选择的为选中状态。

//超过最大值的回调
self.photoAlbumViewController.amountBeyondBlock = ^(){ 
    //可以用来提醒用户超过最大值
};

//选择结果  
self.photoAlbumViewController.assetsResultBlock = ^(NSMutableArray *assets){
    //优化内存,此处的assets为对象,而非图片本身。
};

获取图片

    for (id objc in assets) {
        if (]) { //拍照的结果
            //objc 即为图片;
        }else if (]){ //PhotoKit
            PHAsset *asset = objc;
            PHImageManager *imageManger = [PHImageManager defaultManager];
            [imageManger requestImageForAsset:asset targetSize:CGSizeMake(80*2, 80*2) contentMode:PHImageContentModeDefault options:nil resultHandler:^(UIImage * _Nullable result, NSDictionary * _Nullable info) {
                //result 即为图片;
            }];
        }else if (]){ //ALAssetLibrary
            ALAsset *asset = objc;
            UIImage *image = [UIImage imageWithCGImage:asset.thumbnail];
            //image 即为图片;

        }
    }

Author

YaFei, [email protected]

个人博客:http://blog.csdn.net/u013749108

License

YFPhotoAlbum is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "YFPhotoAlbum",
    "version": "1.0",
    "summary": "A Custome PhotoAlbum.",
    "description": "A Custome PhotoAlbum Which Support AssetsLibrary And PhotoKit.nSupport for single or multi.n* Markdown format.n* Don't worry about the indent, we strip it!",
    "homepage": "https://github.com/lovisty/YFPhotoAlbum",
    "license": "MIT",
    "authors": {
        "Zhao Yafei": "[email protected]"
    },
    "source": {
        "git": "https://github.com/lovisty/YFPhotoAlbum",
        "tag": "1.0"
    },
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "YFPhotoAlbum/Classes/*.{h,m}",
    "resources": "YFPhotoAlbum/Assets/*.png",
    "frameworks": [
        "UIKit",
        "Photos",
        "AssetsLibrary"
    ]
}

Pin It on Pinterest

Share This