iOS Photo Lightbox Viewer

Photo Lightbox Viewer is class to easily add a popup “lightbox” view for showing photos. Photos can be touched and moved, zoomed and closed with any direction swipe. Includes built-in photo downloader for large photos. This package includes full source code and a working demo. View Pricing
scroll down for more

PhotoLightboxViewer is a lightBox viewer that is a quick and powerful way to display a photo in your app. Users can double-tap to zoom, pan, resize the photo, drag and move the photo around the screeen and flick in any direction to dismiss. Has built-in very fast optimized photo downloader that can be used to load photos and show download progress for large photos.

Features

  • Quick display of photos from anywhere in your app
  • Can blur background when displaying photo
  • Great for popping up photos of something a user is interested in.  e.g. Restaurant photo, favorite location photos, photo just taken, Facebook profile photo etc...
  • Display a photo using a remote URL.   Can use a built-in very fast optimized photo downloader to load and show progress.
  • Display a photo using a local URL
  • Display a photo resource from your app
  • Select photo using image picker and display
  • Pan photos
  • Zoom photos
  • Resize photos
  • Drag photo around screen
  • Swipe in any direction to stop display photo
  • Display the photo for image data from your app 

Displaying Photos

PhotoLightboxViewer provides varius ways to show photos or images quickly anywhere or at anytime in your program. Need to show the user a photo or image quickly while allowing the user to zoom and scale image and close with a swipe?

PhotoLightbox Viewer provides static factory methods for easily showing photos:

  • showPhotoUsingUrl - Show a photo using a url.  Includes built-in, optional, image downloader with progress indocator.
  • showPhotoUsingImage - Show a photo using an app image.. 
  • showPhotoUsingImageData - Show a photo using the app image data..
  • selectAndShowPhoto - Select a photo using image picker and show.

Each of these factory methods will load the photo and display in the specified view .

Methods

// shows photo
//
// touch and hold photo to move
// pinch to zoom
// swipe any direction to close

// Show photo using url
//
// NSURL * imageUrl - url of the photo
// UIViewController * parent - parent view controller to show from
// BOOL blurBackground - if TRUE blur the background
//                       if FALSE then do not blur the background
// BOOL useDownloader - if TRUE use downloader to load images (good for large images
//                      if FALSE then loads images now
+ (void)showPhotoUsingUrl:(NSURL *)imageUrl fromParent:(UIViewController *)parent blurBackground:(BOOL)blurBackground useDownloader:(BOOL)useDownloader;

// Show photo using image
//
// UIImage * image - photo image
// UIViewController * parent - parent view controller to show from
// BOOL blurBackground - if TRUE blur the background
//                       if FALSE then do not blur the background
+ (void)showPhotoUsingImage:(UIImage *)image fromParent:(UIViewController *)parent blurBackground:(BOOL)blurBackground;

// show photo using image data
//
// NSData * imageData - photo image data
// UIViewController * parent - parent view controller to show from
// BOOL blurBackground - if TRUE blur the background
//                       if FALSE then do not blur the background
+ (void)showPhotoUsingImageData:(NSData *)imageData fromParent:(UIViewController *)parent blurBackground:(BOOL)blurBackground;

// select and show photo
//
// UIViewController * parent - parent view controller to show from
+ (void)selectAndShowPhoto:(UIViewController *)parent; 

Installation

To install PhotoLightboxViewer into your app, drag the files in the PhotoLightboxViewer folder into your project. Make sure that you indicate copy the files into your project. Also make sure that the Target Membership is checked for all the .m, .png and .jpg images.

Required Frameworks and Libraries

The following frameworks must be included: AssetsLibrary, CoreFoundation, CoreGraphics, Foundation, ImageIO, MessageUI, QuartzCore, Security, SystemConfiguration and UIKit.

Example Project Demo

The package zip also contains an Examples/Demo folder with a working demonstration of using PhotoLightboxViewer called "PhotoLightboxViewerDemo". Open the xcodeproj file in Xcode to build and run the demo..

iOS Support

This project supports iOS 7, iOS 8, iOS 9 and iOS 10.

Code examples

    CGRect rect = [[UIScreen mainScreen] bounds];
    screenWidth = rect.size.width;
    screenHeight = rect.size.height; 

    self.view.backgroundColor = [UIColor blackColor];
    
    // show photo using url...
    //     Note: PhotoLightboxView has a built-in downloader so if the photo is large, no problem...
    //
    // loading remote small (800x536) photo, no background blur and do not use built-in image downloader...
    NSURL * photoUrl = [NSURL URLWithString:@"http://www.markelsoft.com/Sunset.png"];
    [PhotoLightboxViewer showPhotoUsingUrl:photoUrl fromParent:self blurBackground:FALSE useDownloader:FALSE];
    
    // loading remote large (3000x1993) photo, no background blur and use built-in image downloader...
    NSURL * photoUrl2 = [NSURL URLWithString:@"http://www.markelsoft.com/Sunset-large.jpg"];
    [PhotoLightboxViewer showPhotoUsingUrl:photoUrl2 fromParent:self blurBackground:FALSE useDownloader:TRUE];
    
    // loading remote huge (5000x3321) photo, background blur and use built-in image downloader...
    NSURL * photoUrl3 = [NSURL URLWithString:@"http://www.markelsoft.com/Sunset-huge.jpg"];
    [PhotoLightboxViewer showPhotoUsingUrl:photoUrl3 fromParent:self blurBackground:TRUE useDownloader:TRUE];

    // show photo using local image and backgroun blur...
    UIImage * photoImage = [UIImage imageNamed:@"Sunset.png"];
    [PhotoLightboxViewer showPhotoUsingImage:photoImage fromParent:self blurBackground:TRUE];
    
    // show photo using image data and no background blur...
    NSData * photoData = UIImagePNGRepresentation(photoImage);;
    [PhotoLightboxViewer showPhotoUsingImageData:photoData fromParent:self blurBackground:FALSE];

    // select and show a photo…
    [PhotoLightboxViewer selectAndShowPhoto:self];
}

// show small photo, no background blur and no image downloader since is a small photo…
- (void)showSmallPhoto {
    
    NSURL * photoUrl = [NSURL URLWithString:@"http://www.markelsoft.com/Sunset.png"];
    [PhotoLightboxViewer showPhotoUsingUrl:photoUrl fromParent:self blurBackground:FALSE useDownloader:FALSE];
}

// show large photo, no background blur and use image downloader since is a large photo…
- (void)showLargePhoto {
 
    NSURL * photoUrl = [NSURL URLWithString:@"http://www.markelsoft.com/Sunset-huge.jpg"];
    [PhotoLightboxViewer showPhotoUsingUrl:photoUrl fromParent:self blurBackground:FALSE useDownloader:TRUE];
}

// show huge photo, background blur and use image downloader since is a huge photo…
- (void)showHugePhoto {
   
    NSURL * photoUrl = [NSURL URLWithString:@"http://www.markelsoft.com/Sunset-huge.jpg"];
    [PhotoLightboxViewer showPhotoUsingUrl:photoUrl fromParent:self blurBackground:TRUE useDownloader:TRUE];
}


// select and show photo...
- (void)showSelectPhoto {
    
    // select and show photo...
    [PhotoLightboxViewer selectAndShowPhoto:self];
}

Benefits

  • Time-Saving

    Add a quick way to show photos in a stylizer way to your app

  • Cost Effective

    Very lost cost for adding a beeautful way to load photo and images of all sizes.

  • AddITIONAL Benefits

    Even includes built-in image downloader for loading those large phootos and images. User can pan, zoom and cose photo with a gesture.

Features

  • DISPLAY PHOTOS

    Display photo resources, images, image data or load photo from the Internet using a URL.
  • PAN

    Pan the photo easily.
  • ZOOM

    Zoom photo in or out using pinch gestures.
  • Gestures

    Close photo by swiping in any direction.   Easy gestures to pan and zoom.
  • SELECT AND DSPLAY PHOTO

    Use photo picker to select photo then display.
  • LARGE PHOTOS

    Use built-in image downloader with progress indicator to load those large photos or images.
  •  

Pricing

14 day 14-day money-back guarantee

FREE

Single App

  • Perpetual license

  • 3 applications

  • Can distribute binary products only

  • Commercial use

  • 2 months support

$29.99

Developer

  • Perpetual license

  • Unlimited projects

  • Can distribute code and binary products

  • Commercial use

  • 12 months support