Skip to content

zonaryFUND/RDImageViewerController

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RDImageViewerController

Simple image or custom view viewer.

[![CI Status](http://img.shields.io/travis/Akira Matsuda/RDImageViewerController.svg?style=flat)](https://travis-ci.org/Akira Matsuda/RDImageViewerController) Version License Platform

Requirements

  • Runs on iOS 7.0 or later.

Installation

RDImageViewerController is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "RDImageViewerController"

Usage

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

Initialize RDImageViewerController with number of images and image handler.

RDImageViewerController *viewController = [[RDImageViewerController alloc] initWithImageHandler:^UIImage *(NSInteger pageIndex) {
	NSString *imageName = [NSString stringWithFormat:@"%ld.JPG", (long)pageIndex + 1];
	return [UIImage imageNamed:imageName];
} numberOfImage:10 direction:RDPagingViewDirectionRight];

You can show a custom view like this.

RDImageViewerController *viewController = [[RDImageViewerController alloc] initWithViewHandler:^UIView *(NSInteger pageIndex, UIView *reusedView) {
	if (reusedView == nil) {
		// create new view
	}
	// customize view
	return reusedView;
} reuseIdentifier:^NSString *(NSInteger pageIndex) {
	return @"view";
} numberOfImages:10 direction:RDPagingViewDirectionRight];

Please check the sample code to know how to use.

To load asynchronous, do this

RDImageViewerController *viewController = ...
viewController.loadAsync = YES;

The property of 'landscapeMode' is meaning zooming style in landscape. If it is setted RDImageViewerControllerLandscapeModeAspectFit

The other side it is setted RDImageViewerControllerLandscapeModeDisplayFit

You can set the number of preloading images like this.

RDImageViewerController *viewController = ...
viewController.preloadCount = 2;

The view will be reused when scrolled.

Author

Akira Matsuda, [email protected]

License

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

About

Simple viewer not only image but also custom view.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 90.0%
  • C 4.2%
  • Shell 4.1%
  • Ruby 1.7%