Skip to content

Instantly share code, notes, and snippets.

Last active April 13, 2017 23:09
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
// ViewController.swift
// Testviewcontoller
// Created by Ben Liu on 14/4/17.
// Copyright © 2017 Ben Liu. All rights reserved.
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
// Do any additional setup after loading the view, typically from a nib.
NSLog("viewDidLoad is running")
override func viewWillAppear(_ animated: Bool) {
NSLog("viewWillAppear is running")
override func viewDidAppear(_ animated: Bool) {
NSLog("viewDidAppear is running")
override func viewWillDisappear(_ animated: Bool) {
NSLog("viewWillDisappear is running")
override func viewDidDisappear(_ animated: Bool){
NSLog("viewDidDisappear is running")
override func didReceiveMemoryWarning() {
// Dispose of any resources that can be recreated.
@IBAction func onBtnClicked(_ sender: Any) {
let anotherView = UIViewController()
anotherView.view.backgroundColor =
self.present(anotherView, animated: true, completion: nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment