Created
September 27, 2013 19:24
-
-
Save clooth/6733903 to your computer and use it in GitHub Desktop.
segue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// HorizontalSlideSegue.m | |
// YouLapse | |
// | |
// Created by Nico Hämäläinen on 9/27/13. | |
// Copyright (c) 2013 YouLapse Oy. All rights reserved. | |
// | |
#import "HorizontalSlidePushSegue.h" | |
@implementation HorizontalSlidePushSegue | |
- (id)initWithIdentifier:(NSString *)identifier source:(UIViewController *)source destination:(UIViewController *)destination | |
{ | |
if (self = [super initWithIdentifier:identifier source:source destination:destination]) { | |
_isUnwinding = NO; | |
} | |
return self; | |
} | |
- (void)perform | |
{ | |
UIViewController *sourceViewController = (UIViewController*)[self sourceViewController]; | |
UIViewController *destinationController = (UIViewController*)[self destinationViewController]; | |
CATransition* transition = [CATransition animation]; | |
transition.type = kCATransitionPush; | |
if (_isUnwinding == YES) { | |
transition.subtype = kCATransitionFromLeft; | |
[sourceViewController.navigationController.view.layer addAnimation:transition forKey:kCATransition]; | |
[sourceViewController.navigationController popToViewController:destinationController animated:NO]; | |
} else { | |
transition.subtype = kCATransitionFromRight; | |
[sourceViewController.navigationController.view.layer addAnimation:transition forKey:kCATransition]; | |
[sourceViewController.navigationController pushViewController:destinationController animated:NO]; | |
} | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment