swift viewContoller_4_methods_swift

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了swift 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)
        
    }
}

以上是关于swift viewContoller_4_methods_swift的主要内容,如果未能解决你的问题,请参考以下文章

swift 创建,打开和关闭ViewContoller

选项卡栏在转场后消失

swift 4.2 无法将类型“(_)-> Void”的值转换为预期的参数类型“(()-> Void)?”

Swift标准库中的协议_012_swift协议

WKWebView target="_blank" 链接在 safari ios11,swift 4 中打开新标签

swift运算符使用_02_swift基本数据类型