CHAPTER 7 EXERCISE SOLUTIONS

Answer to Question 1

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

Answer to Question 2

The frame property defines the rectangle occupied by the view, with respect to its superview (the view that contains it). Using the frame property enables you to set the positioning and size of a view. Besides using the frame property, you can also use the center property, which sets the center of the view, also with respect to its superview. You usually use the center property when you are performing some animation and just want to change the position of a view.

Get Beginning iOS 5 Application 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.