IOS APP開發入門案例
阿新 • • 發佈:2019-01-14
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控制元件文字: