Created
April 9, 2017 17:18
-
-
Save pffan91/2743052738973280c11af7207ae2578f to your computer and use it in GitHub Desktop.
DecomposingViewControllersAnimations_OriginalCode
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
// Created by Vladyslav Semenchenko on 09/04/2017. | |
// Copyright © 2017 Vladyslav Semenchenko. All rights reserved. | |
import UIKit | |
class InitialViewController: EZViewController { | |
// MARK: - Variables | |
@IBOutlet weak var controlsContainer: UIView! | |
// MARK: - Constraints | |
@IBOutlet weak var ivLogoHorizontalConstraint: NSLayoutConstraint! | |
// MARK: - ViewController Life Circle | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
} | |
override func didReceiveMemoryWarning() { | |
super.didReceiveMemoryWarning() | |
} | |
override func viewDidAppear(_ animated: Bool) { | |
super.viewWillAppear(animated) | |
self.checkUser() | |
} | |
// - MARK: - User interactions | |
@IBAction func registrationButtonPressed(_ sender: Any) { | |
self.navigationController?.pushViewController(R.storyboard.unboarding.registrationViewController()!, animated: true) | |
} | |
@IBAction func loginButtonPressed(_ sender: Any) { | |
self.navigationController?.pushViewController(R.storyboard.unboarding.loginViewController()!, animated: true) | |
} | |
// MARK: - Private | |
func checkUser() { | |
// some code here and then | |
self.animateToLoginPresentation() | |
} | |
// MARK: - Animations | |
func animateToLoginPresentation() { | |
self.ivLogoHorizontalConstraint.constant = -150 | |
UIView.animate(withDuration: 0.7, delay: 0.5, options: .curveEaseInOut, animations: { | |
self.view.layoutIfNeeded() | |
}) { _ in } | |
UIView.animate(withDuration: 0.3, delay: 1.0, options: .curveLinear, animations: { | |
self.controlsContainer.alpha = 1.0 | |
}) { _ in } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment