Latest 0.1.0
Homepage https://github.com/liruwei/LIPhotosKitManager
License MIT
Platforms ios 8.0
Authors

CI StatusVersionLicensePlatform

Easier to use PhotosKit

Example

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

Requirements

  • Xcode 6
  • iOS 8.0 +

Installation

LIPhotosKitManager is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "LIPhotosKitManager"

How to use

Importing Headers then create property and initialization

#import <LIPhotosKitManager.h> //---------------------------------------1

@interface ViewController ()<LIPhotosKitManagerDelegate>
@property (nonatomic, strong) LIPhotosKitManager *manager; //-----------2
@end

@implementation ViewController
- (void)viewDidLoad {
    [super viewDidLoad];

    //------------------------------------------------------------------3
    self.manager = [[LIPhotosKitManager alloc] init];
    self.manager.delagate = self;
}

- (void)managerDidReceivePhotoLibraryChangeNotification
{    
    // delegate method
    // update your datasource and refresh ui
}
@end

Get Albums

You can use allSystemAlbums or allUserCustomAlbums methods to get albums in your device. These methods return a array contain LIAlbum objects.

NSArray *systemAlbums = [self.manager allSystemAlbums];
NSArray *customAlbums = [self.manager allUserCustomAlbums];

Get Photos

Before obtaining Photos, you must get the LIID object. There are two ways to get that object. One is read from LIAlbum object, another is use the allPhotosIDSortByCreateDateAscending:

NSArray *imageIDs = [self.manager allPhotosIDSortByCreateDateAscending:YES];

Everything is ready ,use the following methods to get the photos you want:

  • requestThumbnailImageForID:size:contentMode:target:resultHandler:
  • requestOriginalImageForID:target:resultHandler:
  • requestOriginalImageDataForID:target:resultHandler:

Esample

LIID *idObj = self.imageIDs[index];
UIImageView *imageView = self.imageView;
[self.manager requestThumbnailImageForID:idObj size:CGSizeMake(100, 100) contentMode:0 target:imageView resultHandler:^(UIImage *result, id target, NSDictionary *info) {
    UIImageView *imageView = target;
    imageView.image = result;
}];

Author

Ruwei Li, [email protected]

License

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

Latest podspec

{
    "name": "LIPhotosKitManager",
    "version": "0.1.0",
    "summary": "Easier to use PhotosKit.",
    "description": "TODO: Add long description of the pod here.",
    "homepage": "https://github.com/liruwei/LIPhotosKitManager",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Robert": "[email protected]"
    },
    "source": {
        "git": "https://github.com/liruwei/LIPhotosKitManager.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "LIPhotosKitManager/Classes/**/*"
}

Pin It on Pinterest

Share This