Skip to content
프로젝트

소개

Simple full screen image viewer with image zoom custom view controller transition

디자인 및 미디어

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

Vertigo

Vertigo is a simple image viewer which includes a custom view controller transition that mimics the new iOS 7 Photos app image zoom transition effect.

Image zoom transition

Installation

Requirements

Vertigo requires iOS 7 or greater.

From CocoaPods

Add pod 'Vertigo' to your Podfile.

Manually

Drag the Vertigo folder into your project. If your project doesn't use ARC you must enable it for all the .m files under the Vertigo folder.

Usage

Vertigo includes the following classes:

  • TGRImageViewController is the image viewer itself. The user can double tap on the image to zoom it in or out. A single tap will dismiss the viewer.
  • TGRImageZoomAnimationController is the object that performs the custom transition between your view controller and a TGRImageViewController (that is, the Photos app image zoom transition effect).

To present and dismiss a TGRImageViewController from your view controller using the custom transition effect, your view controller needs to implement the new UIViewControllerTransitioningDelegate protocol and return a TGRImageZoomAnimationController initialized with the image view that will be used as the inital (or final in case of dismissal) point of the transition.

#import "TGRImageViewController.h"
#import "TGRImageZoomAnimationController.h"

@interface MyViewController () <UIViewControllerTransitioningDelegate>
@end

@implementation MyViewController
...
- (id<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source {
    if ([presented isKindOfClass:TGRImageViewController.class]) {
        return [[TGRImageZoomAnimationController alloc] initWithReferenceImageView:self.imageView];
    }
    return nil;
}

- (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed {
    if ([dismissed isKindOfClass:TGRImageViewController.class]) {
        return [[TGRImageZoomAnimationController alloc] initWithReferenceImageView:self.imageView];
    }
    return nil;
}

- (IBAction)showImageViewer {
    TGRImageViewController *viewController = [[TGRImageViewController alloc] initWithImage:self.imageView.image];
    // Don't forget to set ourselves as the transition delegate
    viewController.transitioningDelegate = self;
    
    [self presentViewController:viewController animated:YES completion:nil];
}

Contact

Guillermo Gonzalez
@gonzalezreal

License

Vertigo is available under the MIT license. See LICENSE.

관련 프로젝트 살펴보기

불러오는 중…