1234567891011121314151617181920212223242526272829303132333435 |
- import UIKit
- public protocol NavigationBarInOut: class {
- var navigationView: UIView { get }
- func navigationBarFadeIn()
- func navigationBarFadeOut()
- func navigationBarFadeOutWithPercentage(_ percentage: CGFloat)
- }
- public extension NavigationBarInOut where Self: UIViewController {
- func navigationBarFadeIn() {
- UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 0, options: [], animations: {
- self.navigationView.alpha = 0
- }, completion: nil)
- }
-
- func navigationBarFadeOut() {
- UIView.animate(withDuration: 0.5, animations: {
- self.navigationView.alpha = 1
- }, completion: nil)
- }
-
- func navigationBarFadeOutWithPercentage(_ percentage: CGFloat) {
- self.navigationView.alpha = 1 * percentage
- }
- }
|