Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

2. Hello Pong > Scoring

Scoring

You need to add a couple labels to the view so you can track scores. Bring up Interface Builder and edit the PaddlesViewController.xib file again. Drag over a new label, set the initial Text value to “0,” change Alignment to center, and adjust the font size to at least 24. Move the label flush against the right edge of the view. Now switch over to the Size Inspector and change the Origin to the center position. Modify the Y value to be 200, which is 40 pixels above the center line. The result should look similar to Figure 2-11.

Adding score labels to the view

Figure 2-11. Adding score labels to the view

Copy and paste that label and then position it below the middle line at roughly the same distance. Make sure it is flush against the right side of the view and then change the Y origin to 280, which is 40 pixels below the middle line.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial