Latest 1.1.2
License MIT
Platforms ios 8.0
Dependencies SDWebImage, SDWebImage/GIF, FLAnimatedImage
Frameworks UIKit

CI Status


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


It works with iOS 8.0 and newer.
RXLayoutGallary is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'RXLayoutGallary', :git => ''

RXLayoutGallary – This is Objective-C version fraemwork. Using the library you can add from one up to five photos.
These photos will be posted of the beautiful grid.

iPhone Vertical
alt text

iPad Vertical & Horizontal
alt text


Step 1.

Make import.

#import <RXLayoutGallary/RXLayoutGallary.h>

Step 2.

Conform to protocols.

@interface RXViewController () <RXLayoutGallaryDelegate, NYTPhotosViewControllerDelegate, NYTPhotoViewerDataSource>

Step 3.

Add these properties . They are needed for the correct operation of the framework, which opens photos in full screen mode.

@interface RXViewController () <RXLayoutGallaryDelegate, NYTPhotosViewControllerDelegate, NYTPhotoViewerDataSource>

@property (nonatomic, strong) NSMutableArray *imageForNYTPhotosVC;
@property (nonatomic, strong) NSNumber *numberOfPhotos;
@property (nonatomic, strong) UIImageView *touchedImgView;


Step 4.

Initialize and add to superview the RXLayoutGallary is comfortable for you path.
You have 3 option’s.

  1. Pass to RXLayoutGallary array with URLs
  2. Pass to RXLayoutGallary array with UIImage or NSData (*nsdata only for gif images )
  3. Pass to RXLayoutGallary array with UIImageView
// Init
RXLayoutGallary* gallaryURL = [[RXLayoutGallary alloc] initWithFrame:self.viewForURLGallary.bounds

// Add to some superview
[self.viewForURLGallary addSubview:gallaryURL];
// Add pictures - Path by URL array
[gallaryURL addImageFromURL: self.urlImages];


// Add pictures - Path by UIImage array
[gallaryLocalImages addUIImagesToGallary:self.localImages];


// Add pictures - Path by UIImageViews array
[gallaryURL addUIImageViewsToGallary: self.localImages];

Step 5.

Implement the delegate method.

#pragma mark - GallaryViewDelegate

-(void)rxgallaryView:(RXLayoutGallary *)rxlayoutGallary didTapAtImageView:(UIImageView *)imageView atIndex:(NSUInteger)index{

    self.imageForNYTPhotosVC = [NSMutableArray new];;
    self.numberOfPhotos      = [NSNumber numberWithInteger:rxlayoutGallary.imagesArray.count];
    self.touchedImgView      = imageView;

    for (id imgFromGallary in rxlayoutGallary.imagesArray) {

        RXExamplePhoto *p = [RXExamplePhoto new];
        p.attributedCaptionTitle  = [RXViewController attributedTitleFromString:@"Chess"];
        p.attributedCaptionCredit = [RXViewController attributedCreditFromString:@"Photo: Chris Dzombak"];

        if ([imgFromGallary isMemberOfClass:[UIImageView class]])
            UIImageView* imgView = (UIImageView*)imgFromGallary;
            [self.imageForNYTPhotosVC addObject:({
                p.image = imgView.image;
        if ([imgFromGallary isMemberOfClass:[FLAnimatedImageView class]])
            FLAnimatedImageView* flaImgView = (FLAnimatedImageView*)imgFromGallary;
            [self.imageForNYTPhotosVC addObject:({
                p.imageData =;
    NYTPhotosViewController* vc = [[NYTPhotosViewController alloc] initWithDataSource:self

    [self presentViewController:vc animated:YES completion:nil];

If you want, you can conform methods:
They are need for most productive work with TableView.
You should store in your controller or viewmodel cache property, then images will until upload from local cache.

-(NSData*) getDataFromCacheByURL:(NSString*) urlStr;
-(void) writeToCacheData:(NSData*) data urlKey:(NSString*) key;
-(NSOperationQueue*) getOperationQueue;

Step 6.

Implement the delegate methods.

#pragma mark - NYTPhotoViewerDataSource

- (NSInteger)indexOfPhoto:(id <NYTPhoto>)photo {
    return [self.imageForNYTPhotosVC indexOfObject:photo];

- (nullable id <NYTPhoto>)photoAtIndex:(NSInteger)photoIndex
    if (self.imageForNYTPhotosVC.count > photoIndex){
        return [self.imageForNYTPhotosVC objectAtIndex:photoIndex];
    return  nil;

Step 7. – Optional

Implement the delegate and helpers methods .

#pragma mark - NYTPhotosViewControllerDelegate

- (UIView *)photosViewController:(NYTPhotosViewController *)photosViewController referenceViewForPhoto:(id <NYTPhoto>)photo {
    return self.touchedImgView;

#pragma mark - Helpers

+ (NSAttributedString *)attributedTitleFromString:(NSString *)caption {
    return [[NSAttributedString alloc] initWithString:caption
                                            attributes: @{NSForegroundColorAttributeName: [UIColor whiteColor],
                                                        NSFontAttributeName: [UIFont preferredFontForTextStyle:UIFontTextStyleBody]}];
+ (NSAttributedString *)attributedSummaryFromString:(NSString *)summary {
        return [[NSAttributedString alloc] initWithString:summary
                                               attributes:@{NSForegroundColorAttributeName: [UIColor lightGrayColor],
                                                NSFontAttributeName: [UIFont preferredFontForTextStyle:UIFontTextStyleBody]}];

+ (NSAttributedString *)attributedCreditFromString:(NSString *)credit {
        return [[NSAttributedString alloc] initWithString:credit
                                               attributes:@{NSForegroundColorAttributeName: [UIColor grayColor],
                                               NSFontAttributeName: [UIFont preferredFontForTextStyle:UIFontTextStyleCaption1]}];

Profit !!!!


m1a7, [email protected]


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

Latest podspec

    "name": "RXLayoutGallary",
    "version": "1.1.2",
    "summary": "With help RXLayoutGallary add photos to grid.",
    "description": "Using the library you can add from one up to five photos. These photos will be posted of the beautiful grid.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "m1a7": "[email protected]"
    "source": {
        "git": "",
        "tag": "1.1.2"
    "platforms": {
        "ios": "8.0"
    "source_files": "RXLayoutGallary/Classes/**/*.{h,m}",
    "resource_bundles": {
        "RXLayoutGallary": [
    "public_header_files": "RXLayoutGallary/Classes/*.h",
    "frameworks": "UIKit",
    "dependencies": {
        "SDWebImage": [
            "~> 4.0"
        "SDWebImage/GIF": [],
        "FLAnimatedImage": [
            "~> 1.0"

Pin It on Pinterest

Share This