Latest0.1.1
Homepagehttps://github.com/yuriiik/ISVImageScrollView
LicenseMIT
Platformsios 8.0
Authors

CI Status
Version
License
Platform

A subclass of the UIScrollView tweaked for image preview with zooming, scrolling and rotation support.

Overview

When you need to incorporate an image preview into your application, usually you start with the UIScrollView and then spend hours tweaking it to get functionality similar to the default Photos app. This control provides you out-of-the-box functionality to zoom, scroll and rotate an UIImageView attached to it.

Features

  • Pinch to zoom and scroll
  • Tap to zoom
  • Scale image when scroll view bounds change, e.g. after rotation
  • Set appropriate content offset after rotation to make sure visible content remains the same

Example

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

Requirements

  • Tested on iOS 9.3 and higher, but should work on iOS 8.x as well

Installation

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

pod 'ISVImageScrollView'

Usage

ISVImageScrollView is very easy to use.

  1. Create a UIImageView instance and assign it an image.
  2. Create an ISVImageScrollView instance (either programmatically or via the Storyboard/XIB) and assign the created UIImageView object to its imageView property.
  3. Don’t forget to set maximumZoomScale and delegate properties of the ISVImageScrollView instance.
  4. Finally in delegate class implement viewForZoomingInScrollView: method and return the UIImageView object created in step 1.
UIImage *image = [UIImage imageNamed:@"Photo.jpg" inBundle:nil compatibleWithTraitCollection:nil];
self.imageView = [[UIImageView alloc] initWithImage:image];
self.imageScrollView.imageView = self.imageView;
self.imageScrollView.maximumZoomScale = 4.0;
self.imageScrollView.delegate = self;
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
    return self.imageView;
}

Author

Yurii Kupratsevych

[email protected]

License

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

Latest podspec

{
    "name": "ISVImageScrollView",
    "version": "0.1.1",
    "summary": "A subclass of the UIScrollView tweaked for image preview with zooming, scrolling and rotation support.",
    "description": "When you need to incorporate an image preview into your application, usually you start with the UIScrollView and then spend hours tweaking it to get functionality similar to the default Photos app.nThis control provides you out-of-the-box functionality to zoom, scroll and rotate an UIImageView attached to it.",
    "homepage": "https://github.com/yuriiik/ISVImageScrollView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Yurii Kupratsevych": "[email protected]"
    },
    "source": {
        "git": "https://github.com/yuriiik/ISVImageScrollView.git",
        "tag": "0.1.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "ISVImageScrollView/Classes/**/*"
}

Pin It on Pinterest

Share This