Skip to Main Content
Beginning iOS 4 Application Development
book

Beginning iOS 4 Application Development

by Wei-Meng Lee
October 2010
Beginner content levelBeginner
655 pages
14h 9m
English
Wrox
Content preview from Beginning iOS 4 Application Development

Chapter 7. Screen Rotations

WHAT YOU WILL LEARN IN THIS CHAPTER

  • How to support the four different types of screen orientations

  • The various events that are fired when a device rotates

  • How to reposition the views on a View when the orientation of a device changes

  • How to change the screen rotation dynamically during runtime

  • How to set the orientation of your application before it is loaded

The Hello World! application in Chapter 2 showed you how your iPhone application supports viewing in either the portrait or landscape mode. This chapter dives deeper into the topic of screen orientation. In particular, it demonstrates how to manage the orientation of your application when the device is rotated. You will also learn how to reposition your views when the device is rotated so that your application can take advantage of the change in screen dimensions.

Responding to Device Rotations

One of the features that modern mobile devices support is the capability to detect the current orientation — portrait or landscape — of the device. An application can take advantage of this to readjust the device's screen to maximize use of the new orientation. A good example is Safari on the iPhone. When you rotate the device to landscape orientation, Safari automatically rotates its view so that you have a wider screen to view the content of the page (see Figure 7-1).

In the iPhone SDK, there are several events that you can handle to ensure that your application is aware of changes in orientation. Check them out ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning iOS 5 Application Development

Beginning iOS 5 Application Development

Wei-Meng Lee

Publisher Resources

ISBN: 9780470918029Purchase book