iOS - Actions and Outlets (from tutorialspoint)
Introduction
Actions and outlets in iOS are referred to as ibActions and ibOutlets respectively where ib stands for interface builder. These are related to the UI elements and we will explore them after knowing visually how to implement them.Steps Involved
1. Let's use our First iPhone Application.2. Select the ViewController.xib file from the files in the navigator section.
3. Now you can select the UI elements from the library pane in right hand side of our window which is shown below.
5. Let add a Label and Round Rect Button to our view.
8. Now right click on the label and select, hold and drag new referencing outlet as shown below
11. Similarly to add an action right click the Round rect button, select touch up inside and drag it below the curly braces
-(IBAction) setTitleLabel:(id)sender{ }14. Add a statement as shown below inside the above method.
[myTitleLabel setTitleText:@"Hello"];15. Now let's run the program by selecting the run button. You will see the following output.
18. So from the above example we can conclude that IBOutlet creates a reference to the UIElement (here for the UILabel) and similarly the IBAction links the UIButton with a method which is called on the event touch up inside.
19. You can play around with actions by selecting different events while creating the action.