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 />

19<br />

With the buttons taken care of, you’re left with connecting the label controls to the<br />

CoinTossViewController class to allow the code to update the user interface with the<br />

results of the latest coin toss.<br />

To connect the label controls, you can use a similar drag-and-drop operation.<br />

This time, while holding down the Control key, click the icon representing the<br />

CoinTossViewController instance and drag it toward the label in the view. When<br />

you release the mouse, a pop-up menu appears that allows you to select which property<br />

of the CoinTossViewController class you want to connect the label control to.<br />

This process is demonstrated in figure 1.9. Using this process, connect the label<br />

titled Coin Toss to the status property and the label titled Select Heads or Tails to<br />

the result property.<br />

When deciding which way you should form connections between objects, consider<br />

the flow of information. In the case of the button, tapping the button causes a method<br />

Figure 1.9 Visually forming a connection between the status instance variable and the label control in the user<br />

interface by dragging and dropping between the items (with the Control key held down)

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

Saved successfully!

Ooh no, something went wrong!