All Projects → Alterplay → APPhotolibrary

Alterplay / APPhotolibrary

Licence: MIT license
Easy access to photo album on iOS

Programming Languages

objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language

APPhotolibrary is a wrapper on ALAssetsLibrary and a category for ALAsset

Features

  • Asynchronous loading of photo library assets
  • Asynchronous sorting of assets
  • Asynchronous loading of full resolution photo from asset
  • Asynchronous loading of full screen photo from asset

Installation

Add APPhotolibrary pod to Podfile

Using

Load photos
APPhotolibrary *photolibrary = [[APPhotolibrary alloc] init];
[photolibrary loadPhotosAsynchronously:^(NSArray *assets, NSError *error)
{
    if (!error)
    {
        // show assets
    }
    else
    {
        // show error
    }
}];
Sort photos
photolibrary.sortAscending = YES;
photolibrary.sortComparator = ^NSComparisonResult(ALAsset *asset1, ALAsset *asset2)
{
    // return result of comparsion two assets   
};

Default sort is by date

Get photo from asset
#import "ALAsset+Photo.h"
...
ALAsset *asset = // assign asset
// photo thumbnail
self.thumbnailImageView.image = asset.photoThumbnail;
// load fullscreen photo (size depends on device screen)
__weak __typeof(self) weakSelf = self;
[asset loadPhotoInFullScreenAsynchronously:^(UIImage *image)
{
    weakSelf.fullScreenImageView.image = image;
}];
// load full resolution photo
[asset loadPhotoInFullResolutionAsynchronously:^(UIImage *image)
{
    weakSelf.fullScreenImageView.image = image;
}];

History

Version 0.0.2

  • Added external access to assets library. Thanks to Bob Spryn.

Version 0.0.1

  • First release

githalytics.com alpha

======================= Check out all Alterplay's GitHub projects. Email us with other ideas and projects.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].