Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gonzalezreal/vertigo
Simple full screen image viewer with image zoom custom view controller transition
https://github.com/gonzalezreal/vertigo
Last synced: 1 day ago
JSON representation
Simple full screen image viewer with image zoom custom view controller transition
- Host: GitHub
- URL: https://github.com/gonzalezreal/vertigo
- Owner: gonzalezreal
- License: other
- Created: 2013-10-07T12:31:30.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-12-11T04:13:23.000Z (about 9 years ago)
- Last Synced: 2025-02-13T08:09:33.449Z (8 days ago)
- Language: Objective-C
- Homepage:
- Size: 1.67 MB
- Stars: 355
- Watchers: 12
- Forks: 52
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.
![]()
## 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.
```objc
#import "TGRImageViewController.h"
#import "TGRImageZoomAnimationController.h"@interface MyViewController ()
@end@implementation MyViewController
...
- (id)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source {
if ([presented isKindOfClass:TGRImageViewController.class]) {
return [[TGRImageZoomAnimationController alloc] initWithReferenceImageView:self.imageView];
}
return nil;
}- (id)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](http://github.com/gonzalezreal)
[@gonzalezreal](https://twitter.com/gonzalezreal)
## License
Vertigo is available under the MIT license. See [LICENSE](https://github.com/gonzalezreal/Vertigo/blob/master/LICENSE).