Skip to content

Instantly share code, notes, and snippets.

@arkilis
Last active April 13, 2017 23:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arkilis/67e0f0f3b9fb7ce3e81d69e23765f606 to your computer and use it in GitHub Desktop.
Save arkilis/67e0f0f3b9fb7ce3e81d69e23765f606 to your computer and use it in GitHub Desktop.
viewContoller_4_methods_swift
//
// 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() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
NSLog("viewDidLoad is running")
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
NSLog("viewWillAppear is running")
}
override func viewDidAppear(_ animated: Bool) {
NSLog("viewDidAppear is running")
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
NSLog("viewWillDisappear is running")
}
override func viewDidDisappear(_ animated: Bool){
NSLog("viewDidDisappear is running")
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func onBtnClicked(_ sender: Any) {
let anotherView = UIViewController()
anotherView.view.backgroundColor = UIColor.red
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