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.

24 CHAPTER 1 Building your first iOS application<br />

Figure 1.13 Setting a breakpoint to break into the debugger whenever the first line of the simulateCoinToss:<br />

method is called. Notice the arrow in the margin indicating an active breakpoint.<br />

For the Coin Toss game, let’s add a breakpoint to the start of the simulateCoinToss:<br />

method. Open the CoinTossViewController.m file and scroll down to the source code<br />

implementing the simulateCoinToss: method. If you then click the left margin<br />

beside the first line, you should see a little blue arrow appear, as shown in figure 1.13.<br />

The blue arrow indicates that this line has an enabled breakpoint. If you click the<br />

breakpoint, it becomes a lighter shade of blue, indicating a disabled breakpoint, which<br />

causes the debugger to ignore it until it’s clicked again to re-enable it. To permanently<br />

remove a breakpoint, click and drag the breakpoint away from the margin. Releasing<br />

the mouse will show a little “poof” animation, and the breakpoint will be removed.<br />

1.6.3 Running the CoinToss game in the iPhone simulator<br />

With the breakpoint in place, you’re finally ready to run the application and see it in<br />

action. Select Run from the Product menu (Cmd-R). After a few seconds, the application

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

Saved successfully!

Ooh no, something went wrong!