Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Check your devices

This is where the code paths for the iPhone and the iPad are going to intersect—in the App Delegate. Because we’re migrating an existing iPhone application, we already have an AppDelegate and it’s set up to add our RootViewController to the window when the application launches.

Now that we’ve added iPad-specific views, we need to update our AppDelegate to add the correct one to the window depending on the device. iOS makes it easy to determine which device you’re on through a macro named UI_USER_INTERFACE_IDIOM(). This returns a constant that tells you the type of device your application is running on; we can use this to figure out which view controller to show in the window.

image with no caption

Now it’s ready to run...

Test Drive


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint