iOS - Actions and Outlets

Activities and sites in iOS are generally known as ibActions and ibOutlets respectively, where ibstands for interface designer. These are relevant to the UI components and we will discover them after understanding creatively how to apply them.

Actions and Outlets – Steps Involved

Step 1 − Let's use our First iPhone Application.
Step 2 − Select the ViewController.xib file from the files in the navigator section.
Step 3 − Now, you can select the UI elements from the library pane in the right hand side of our window, which is shown below.
Step 4 − You can drag and drop the UI elements to our view in our interface builder.
Step 5 − Let us add a Label and Round Rect Button to our view.
Step 6 −From the Manager Selector key in the workplace plugin discovered on the top right area as proven below.
Step 7 −  We will see two ms windows in our manager place in the middle, one is ViewController.xib computer file and the other is ViewController.h.
Step 8 − Now, right simply simply click the brand and choose, hold and move the new referencing store as proven below.
Step 9 − Drop in the ViewController.h in between the curly braces. In case there are no curly braces in the file, add the ViewController before doing this. You will find a pop-up as shown below.
Step 10 − Kind the brand name for the store, here we have used the brand myTitleLabel. Just click link and the ibOutlet will be finish.
Step 11 − Similarly, to add an action, right click the Round rect button, select touch up inside and drag it below the curly braces.
Step 12 − Drop it and name it setTitleLabel.
Step 13 − Select ViewController.m file, you'll find a method as shown below.
-(IBAction) setTitleLabel:(id)sender{
}
Step 14 − Add a statement as shown below inside the above method.
[myTitleLabel setText:@"Hello"];
Step 15 − Let us now run the program by selecting the run button. You will see the following output.
Step 16 − Now click the button.
Step 17 − The label that we created have been changed by the action on the button.
Step 18 From the above example, we can determine that IBOutlet makes a referrals to the UIElement (here for the UILabel). In the same way, the IBAction hyperlinks the UIButton with a technique, which is known as on the occasion contact up within.
Step 19 − You can perform around with activities by choosing different activities while developing the activity.