Latest 1.0.1
Homepage https://github.com/Cloudist/CLImageViewer
License MIT
Platforms ios 7.0, requires ARC
Dependencies SDWebImage
Authors

A light weight, easy to use and cool image viewer for iOS.
It provides:

  • Support both local and web image.
  • Double tap and pinch to zoom, single tap to dismiss.
  • Support two kinds of animation to dismiss image back to the original location.

Screenshot

How To Use?

Usage is simple. Here’s what your simplest implementation might look like:

    - (void)onSomeImageClicked:(id)sender {
        NSMutableArray* imageUrls = [NSMutableArray new];
        NSMutableArray* placeHoldeImages = [NSMutableArray new];
        NSMutableArray* referenceRects = [NSMutableArray new];
        NSUInteger imageIndex = 0;
        UIView* referenceView = nil;

        //configure your imageUrls, placeHoldeImages, referenceRects, imageIndex and referenceView
        //...

        CLImageViewer* imagesViewer = [CLImageViewer new];
        CLImageInfo* imagesInfo = [CLImageInfo new];
        imagesInfo.imageURLs = imageUrls;
        imagesInfo.placeholderImages = placeHoldeImages;
        imagesInfo.referenceView = referenceView;
        imagesInfo.referenceRects = referenceRects;
        imagesInfo.startImageIndex = imageIndex;

        imagesViewer.imageInfo = imagesInfo;
        imagesViewer.fromController = weakSelf;
        [imagesViewer showImageViewFromOriginPosition];
    }

Further details can be found in CLImageViewerDemo.
That’s it.

How to Install´╝č

There are two ways to use CLImageViewer in your project:

  • using CocoaPods, pod 'CLImageViewer'
  • copying all the files into your project

Tips

  • Just Local Images:
    If you don’t have the web image already, just set the placeholderImages property when setting up the CLImageInfo instance, do not set the imageURLs property.

  • Auto Sroll To Original Location:
    In some cases, the original location of the image you are watching is out of the screen.

    This situation, you can set needSrollToOrigin property to YES when setting up the CLImageInfo instance. At the same time the referenceRects property should be add just one element which value is from the first opened image.

    After this, when you single tap any image you are watching, the images list will auto scroll to the image which you first opened, then back to it’s original location.

Future Enhancements

  • Optimizing Performance
  • Simplify the interface

License

MIT License, see the included file.

Latest podspec

{
    "name": "CLImageViewer",
    "version": "1.0.1",
    "summary": "A light weight, easy to use and cool image viewer for iOS.",
    "homepage": "https://github.com/Cloudist/CLImageViewer",
    "license": "MIT",
    "authors": {
        "esrever10": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/Cloudist/CLImageViewer.git",
        "tag": "1.0.1"
    },
    "source_files": "CLImageViewer/*.{m,h}",
    "requires_arc": true,
    "dependencies": {
        "SDWebImage": [
            "~> 3.7.2"
        ]
    }
}

Pin It on Pinterest

Share This