IOS APP開發入門案例


1.創建新項目

2.設計布局,main.storyboard中,在控件庫中

3.布局控件關聯控制器

4.設置事件或者顯示模式

5.編寫代碼:

import UIKit

class ViewController: UIViewController {
    @IBAction func btn1(_ sender: UIButton) { label1.text="我的第一個程序" }
    @IBOutlet weak var label1: UILabel!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }
    @IBOutlet weak var hello: UILabel!
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}

最后運行:

點擊按鈕改變label控件文字:

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM