Custom modal transition animation
- iOS 8.0+
- Xcode 7.2
Just add the ScaleTransition.swift file to your project.
or use CocoaPods with Podfile:
pod 'ScaleTransition', '~> 1.0.3'// create viewcontroller
let storyboard = UIStoryboard(storyboard: .Main)
let detail: DetailViewController = storyboard.instantiateViewController()
// configure transition
detail.transitioningDelegate = self
detail.modalPresentationStyle = .Custom
// present viewController
navigationController?.presentViewController(detail, animated: true, completion: nil)// MARK: transition delegate
extension ViewController: UIViewControllerTransitioningDelegate {
func animationControllerForPresentedController(presented: UIViewController,
presentingController presenting: UIViewController,
sourceController source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return ScaleShowTransition(duration: 0.5, scale: 0.9)
}
func animationControllerForDismissedController(dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return ScaleHideTransition(duration: 0.5, scale: 0.9)
}
}ScaleTransition is released under the MIT license. See LICENSE for details.
If you have any questions, you can write me dev.aleksey@yandex.ru
