Latest 1.0.1
Homepage https://github.com/meiwin/NgImageLoader
License MIT
Platforms ios 7.0, requires ARC
Dependencies NgImageFileIO
Frameworks MobileCoreServices, ImageIO
Authors

Build Status

Objective-c image loading library.

Adding to your project

If you are using CocoaPods, add to your Podfile:

pod NgImageLoader

To manually add to your projects:

  1. Add all files in NgImageLoader folder to your project.
  2. Add these frameworks to your project: MobileCoreServices, ImageIO

Features

NgImageLoader provides convenience APIs for loading image from file and web.

The loader provides block-based and delegate style callback for responding to loading result.

To load an image, create instance of NgImageLoader by specifying the image’s URL and invoke the load method to start loading. Invoke cancel method should the loading be cancelled.

Usage

Example: loading a web image.


// image URL
NSURL * url = [NSURL URLWithString:@"http://www.getyourphonefix.com/images/logo-apple.png"];

NgImageLoader * loader = [NgImageLoader imageLoaderWithURL:URL completionHandler:^(NgImageLoaderState state, id image, NgImageLoaderImageKind kind, NSError * error) {

  // handle loading result/error here
  // this callback can be executed in any thread

}];

// start loading
[loader load];

Example: loading a local image.


// url to image file
NSURL * URL = [NSURL fileURLWithPath:@"path-to-image-file.nef"];

NgImageLoader * loader = [NgImageLoader imageLoaderWithFileURL:URL completionHandler:^(NgImageLoaderState state, id image, NgImageLoaderImageKind kind, NSError * error) {

  // handle loading result/error here
  // this callback can be executed in any thread

}];

// start loading
[loader load];

GIF Handling

If image is a GIF, loader will automatically decode it as animated UIImage instance. If this behavior is not desirable, it can be turned off by setting decodeGIFAsAnimatedUIImage to NO.

When setting decodeGIFAsAnimatedUIImage to NO, NgImageLoader will return image as NSData instance. This is useful particularly when you intend to use other animated image implementation, e.g. FLAnimatedImage.

Latest podspec

{
    "name": "NgImageLoader",
    "version": "1.0.1",
    "summary": "Objective-c image loader library.",
    "homepage": "https://github.com/meiwin/NgImageLoader",
    "authors": {
        "Meiwin Fu": "[email protected]"
    },
    "source": {
        "git": "https://github.com/meiwin/ngimageloader.git",
        "tag": "v1.0.1"
    },
    "source_files": "NgImageLoader/**/*.{h,m}",
    "requires_arc": true,
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "frameworks": [
        "MobileCoreServices",
        "ImageIO"
    ],
    "platforms": {
        "ios": "7.0"
    },
    "dependencies": {
        "NgImageFileIO": [
            "~> 1.1"
        ]
    }
}

Pin It on Pinterest

Share This