viewContoller_4_methods_swift
This file contains 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
// | |
// 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