Sunday, July 27, 2014

Understanding IBOutlet and IBAction in InterfaceBuider

In XCode interface builder, when adding a UI element in storyboard, it only creates an UI element, for example UITableView or UILabel, or UIViewController, and it does not give the element reference to be accessed by external module.

However, each of these class can define property, method and IBOutlet & IBAction for external access. Actually, the IBOutlet is just a regular property, the only extra thing IBOutlet does is telling Interface Builder that this property is available to associate with other instance within the current uiViewController scope at design time, so developer can make the association easily in interface builder between IBOutlet and other elements.

So IBOutlet is only meaningful within InterfaceBuilder's UIViewController context so as to allow design time association. Similarly, the Referencing outlet shows the current UI element instance is referenced by all other instances' outlet property.

Note, you can add any object into interface builder, and they will be allocated at runtime by interface builder, and any IBOutlet can associate with those arbitrary object, even if they are nothing to do with UIView. 

2 comments:

  1. Your blogs are great. Are you also searching for nursing capstone writing project? we are the best solution for you. We are best known for delivering quality nursing capstone writing services to students without having to break the bank

    ReplyDelete
  2. Good blog. Keep sharing. I love them Are you also searching for Cheap assignment help? we are the best solution for you. We are best known for delivering cheap assignments to students without having to break the bank

    ReplyDelete