• Stars
    star
    355
  • Rank 119,764 (Top 3 %)
  • Language
    Objective-C
  • License
    Other
  • Created about 11 years ago
  • Updated almost 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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.

More Repositories

1

swift-markdown-ui

Display and customize Markdown text in SwiftUI
Swift
2,372
star
2

Groot

From JSON to Core Data and back.
Objective-C
534
star
3

DefaultCodable

A convenient way to handle default values with Swift Codable types
Swift
353
star
4

AttributedText

Render attributed strings in SwiftUI
Swift
122
star
5

Markup

Lightweight markup text formatting in Swift
Swift
95
star
6

AdaptiveCardUI

Snippets of UI, authored in JSON and rendered with SwiftUI
Swift
92
star
7

ReadingList

An example on using the Mantle Modeling Framework with Overcoat AFNetworking extension.
Objective-C
86
star
8

NetworkImage

Asynchronous image loading in SwiftUI
Swift
69
star
9

SimpleNetworking

Scalable and composable API Clients using Swift Combine
Swift
51
star
10

IndeterminateTypesWithCodable

Indeterminate Types with Codable in Swift
Swift
37
star
11

Borders

Sample code for Consuming Web Services with Swift and ReactiveX
Swift
33
star
12

TGRDataSource

Convenience UITableView and UICollectionView data sources
Objective-C
24
star
13

SwiftCommonMark

Parse and create CommonMark documents in Swift.
C
23
star
14

Gig

A great Twitter API client for Objective-C
Objective-C
19
star
15

Reusable

iOS cell registration and reusing with generics and protocol extensions
Swift
13
star
16

DirectLine

Swift client library for Microsoft Bot Framework's Direct Line protocol
Swift
11
star
17

rxswift-gentle-introduction

A gentle introduction to RxSwift http://www.vsmobile.tech
7
star
18

swift-any-value

A Swift Codable type that serves as a placeholder for any JSON value
Swift
3
star
19

NSSpain2016

From Design to Code
3
star
20

TwitterTimeline

Source code for my article 'Implementando una timeline de Twitter con Core Data'
Objective-C
2
star