01.02.2014 Views

Objective-C Fundamentals

Objective-C Fundamentals

Objective-C Fundamentals

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

Figure 1.14<br />

The Xcode debugger window after execution has reached a breakpoint<br />

Your breakpoint caused the debugger to pause<br />

execution at the beginning of a simulated coin<br />

toss. If you view the variables pane or hover the<br />

mouse over the userCalledHeads argument, you<br />

can determine if the user has called heads (YES) Figure 1.15 The toolbar options in Xcode<br />

or tails (NO).<br />

for controlling the debugger<br />

The first line of the simulateCoinToss:<br />

method simulates flipping a coin (by selecting a random number, 0 or 1). Currently,<br />

the debugger is sitting on this line (indicated by the red arrow in the margin), and the<br />

statements on this line haven’t been executed.<br />

To request that the debugger execute a single line of source code and then return<br />

to the debugger, you can click the Step Over button to “step over” the next line of<br />

source code. This causes the coin toss to be simulated, and the red arrow should jump<br />

down to the next line that contains source code. At this stage, you can determine the

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

Saved successfully!

Ooh no, something went wrong!