You’re previewing Ry’s Cocoa Tutorial
As we saw in the previous chapter, the
AppDelegate class is
where you write the code that defines the custom behavior of your app, and the
MainMenu.xib NIB file is where you create the user interface. This
gives us two distinct aspects of a Cocoa app: the code layer and the graphical
One of the core problems in application development is connecting these two layers. Buttons are useless if you can’t determine when the user clicks them, as are text fields if you can’t choose what they say from inside your code. A functional app requires 2-way communication between its code and its UI components.
Cocoa’s solution to this problem is two-fold. The target-action design pattern tells the code layer when the user interacts with a UI component, and the outlets pattern allows you to alter UI components from within the code layer. Implementing these patterns is one of the most important jobs of Interface Builder.
In this chapter, we’ll begin by learning how to lay out a user interface and configure UI components. Then, we’ll explore how Interface Builder facilitates the connection between this interface and the code layer of an application.
Sorry, this is the end of the preview. To read the rest of this chapter, you’ll need to purchase Ry’s Cocoa Tutorial.
Sign up for my low-volume mailing list to find out when new content is released. Next up is a comprehensive Swift tutorial planned for late January.
You’ll only receive emails when new tutorials are released, and your contact information will never be shared with third parties. Click here to unsubscribe.