Notification Center

In the simulator, select
Hardware → Rotate Right.

We will need the notification center to play a video. See Notification Programming. Here is a simple example of how to use the center. The center sends the setNeedsDisplay message to a view whenever the orientation of the device changes. The view reacts by displaying a message: “portrait”, “landscape”, etc. When we have a view controller, we’ll be able to make the text run the right way.

Source code in

  1. main.m
  2. Class NoteAppDelegate
  3. Class View

Things to try

  1. When I quit the iOS 7 simulator and run the app again, the simulator is launched and the app displays the string “Unknown”. This happens even if we begin generating device orientation notifications at the start of application:didFinishLaunchingWithOptions: before we create the view. How can we correct this?

  2. Should we set up and break down the notification at the birth and death of the view, rather than the birth and death of the application delegate?