confused difference between Custom Class for an Object and for the File's Owner and steps via IB

后端 未结 2 1519
灰色年华
灰色年华 2021-01-03 13:23

This is another \"I\'m confused question\". So I\'m working on bringing in custom views into a view controller. I\'ll just outline the exact steps for the error.

    <
2条回答
  •  独厮守ぢ
    2021-01-03 13:44

    Define an IBOutlet @property in your parent class's @interface section like this:

    @property (weak, nonatomic) IBOutlet ArcView *arcView
    

    Then go into Interface Builder, and right click on File's Owner. When you see "arcView" in the black HUD window, drag the mouse from that item to your view on the XIB.

    Now you have a property for your arcview control, and you can utilize it just like you would any control such as UIButton, UILabel etc.

提交回复
热议问题