IBOutlet in objective-c

后端 未结 3 1402
忘掉有多难
忘掉有多难 2020-12-22 02:12

what does this line of code do :

IBOutlet UITextField *userName;

3条回答
  •  攒了一身酷
    2020-12-22 02:59

    IBOutlet exposes variables in Interface Builder.

    Example: go to Interface Builder, right click the class containing that line, and you will see a element userName. Unlike the other members of that class, it appears because it has been declared using IBOutlet. If you drag a line from that element to a UITextField control, any operation on the variable (eg: accessing its contents with userName.text) will be performed on the GUI element.

提交回复
热议问题