How do you use Interface builder with Swift?

后端 未结 5 1658
日久生厌
日久生厌 2021-02-07 12:11

When hooking Swift code up to a Storyboard, how do you add the IBAction and IBOutlet tags?

5条回答
  •  轮回少年
    2021-02-07 12:41

    While creating a project, you should have selected the storyboard, so that you can add your IBOutlet's directly in the story board.

    The Below code gives you a idea of how to add IBOutlet to the UILabel

    class ViewController: UIViewController {
    
        @IBOutlet var label : UILabel
    
    }
    

提交回复
热议问题