O'Reilly logo

Beginning iPad™ Application Development by Wei-Meng Lee

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix A. Answers to Exercises

This appendix provides the solutions for the end-of-chapter exercises located at the ends of Chapters 218 (there are no exercises in Chapter 1).

CHAPTER 2 EXERCISE SOLUTIONS

Answer to Question 1

The minimum image size you should design is 72 × 72 pixels. It is all right to design a larger image because the iPad automatically resizes it for you. In general, try to design a larger image because doing so prepares your application for the newer devices that Apple may roll out.

Answer to Question 2

You should implement the shouldAutorotateToInterfaceOrientation: method and code the appropriate statements to support the orientation you want. To support all orientations, simply return a YES in this method. The following code snippet supports the portrait and landscape left modes:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)
interfaceOrientation {
    // Return YES for supported orientations
    // return YES;
    return (interfaceOrientation==UIInterfaceOrientationPortrait ||
interfaceOrientation==UIInterfaceOrientationLandscapeLeft);

}

Answer to Question 3

This is to ensure that the image is always copied into the Resources folder. If not, Xcode only makes a reference to the image and the image is not physically in the Resources folder.

CHAPTER 3 EXERCISE SOLUTIONS

Answer to Question 1

In the .h file:

//---declare an outlet---
IBOutlet UITextField *nameTextField;
//...
//...
//---expose the outlet as a property---
@property (nonatomic, retain) UITextField ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required