Created
June 28, 2015 01:42
-
-
Save ajonno/114321dda5d2ab36260a to your computer and use it in GitHub Desktop.
Custom segue animation DONE RIGHT (no post render flashing)
This file contains 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
class InitialLBPSegue: UIStoryboardSegue { | |
override func perform() { | |
var firstVCView = sourceViewController.view as UIView! | |
var thirdVCView = destinationViewController.view as UIView! | |
let window = UIApplication.sharedApplication().keyWindow | |
window?.insertSubview(thirdVCView, belowSubview: firstVCView) | |
thirdVCView.transform = CGAffineTransformScale(thirdVCView.transform, 0.001, 0.001) | |
UIView.animateWithDuration(0.5, animations: { () -> Void in | |
firstVCView.transform = CGAffineTransformScale(thirdVCView.transform, 0.001, 0.001) | |
}) { (Finished) -> Void in | |
UIView.animateWithDuration(0.5, animations: { () -> Void in | |
thirdVCView.transform = CGAffineTransformIdentity | |
}, completion: { (Finished) -> Void in | |
firstVCView.transform = CGAffineTransformIdentity | |
self.sourceViewController.presentViewController(self.destinationViewController as! UIViewController, animated: false, completion: nil) | |
}) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment