Appendix

This appendix contains the answers to the exercises that are found at the end of each chapter.

Chapter 2

1. The easiest way to find anything in your code is by using the Search navigator in the Navigation area. Simply bring up the Search navigator by clicking the magnifying glass icon at the top of the Navigation area. Then, type viewDidLoad in the search box. The Navigation area will show the search results. Click on one of the results to move into the code file where you found the viewDidLoad method.

2. You can use the Issue navigator to see a list of the errors that the compiler found. You can click on any issue to navigate to the source of the error in your code. Fixing issues will cause the old issue to disappear from the Issue navigator.

3. You can easily re-indent blocks of code by highlighting them in the editor and choosing Editor ⇒ Structure ⇒ Re-indent from the menu bar. Executing the Re-indent command on the given code results in the following indentation:

for (int i=0;i<10;i++){
    for (j=0; j<100; j++) {
        for (k=100; k>0; k--) {
            // Do something in your code
            
        }
    }
}

Notice how it is now easy to see the structure of the nested loops.

4. Open the Quick Help inspector and put the cursor on the viewDidLoad method in the SampleUIViewController.m code file. In the Quick Help inspector, you will see that viewDidLoad is declared in UIViewController.h.

5. Start a new Single View Application. I called mine, “Exercise.” Open the XIB file in Interface builder and drag ...

Get Beginning iOS Game Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.