- ARC
- Storyboards
- The Ninja Move
- Auto Layout
- Instruments
- Unit Testing
The Ninja Move
One of the best things about using Storyboards (or about using Interface Builder in general) is the ability to draw connections between the graphical user interface and your code. I call this The Interface Builder Ninja Move.
Switch to the Assistant editor. Open the Storyboard in the main editing window, and zoom into a scene. In the secondary window, make sure that scene’s view controller’s .m file is displayed, and navigate to the class extension.
Now, in Interface Builder, select one of the controls. Control-click on the control, and drag down to the class extension (see Figure 2). When you let go of the mouse, Xcode will prompt you to create an outlet for that control. This will not only define a private outlet in our class, but it will also connect the outlet to the control in the Storyboard.
For controls that produce actions (like buttons), Control-drag down to the method definitions, and let go. Now Xcode will prompt you to create an action. Again, it will define a private action in our code, and link the button to the action in the Storyboard.
This is just one example of how Storyboards can improve efficiency. Here, I can connect my user interface to my code with just a few clicks of the mouse.