Skip to content

Instantly share code, notes, and snippets.

@tualatrix
Created April 13, 2018 08:44
Show Gist options
  • Save tualatrix/665fc6fbc3fba37c006299d93ae82426 to your computer and use it in GitHub Desktop.
Save tualatrix/665fc6fbc3fba37c006299d93ae82426 to your computer and use it in GitHub Desktop.
Perfect presentation animation of iOS Share Extensions's Navigation Controller
//
// ShareNavigationController.swift
//
// Created by Tualatrix Chou on 2018/04/13.
//
// Use as the root navigation controller
import UIKit
class ShareNavigationController: UINavigationController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.view.transform = CGAffineTransform(translationX: 0, y: self.view.frame.size.height)
UIView.animate(withDuration: 0.3, delay: 0, options: UIViewAnimationOptions(rawValue: 7 << 16 | UIViewAnimationOptions.allowAnimatedContent.rawValue), animations: {
self.view.transform = .identity
}, completion: nil)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment