01.02.2014 Views

Objective-C Fundamentals

Objective-C Fundamentals

Objective-C Fundamentals

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Hooking up the user interface<br />

17<br />

Figure 1.7 Dragging and dropping new controls onto the view. Notice the snap lines, which help ensure your user<br />

interface conforms to the iOS Human Interface Guidelines (HIG).<br />

1.4.2 Connecting controls to source code<br />

The user interface you just created meets these requirements, but the code can’t<br />

determine which button should indicate that the user calls heads or tails (even if the<br />

text on the buttons makes it inherently obvious to a human). Instead, you must explicitly<br />

establish these connections. Xcode allows you to do so graphically.<br />

Hold down the Control key and drag the button labeled Heads toward the icon<br />

representing the CoinTossViewController instance (File’s Owner) located on the left<br />

edge of the editor. As you drag, a blue line should appear between the two elements.<br />

When you let go of the mouse, a pop-up menu appears that allows you to select<br />

which message should be sent to the CoinTossViewController object whenever the

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!