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
Share this Page URL
Help

5. Plists and Modal Views: Refining your... > Any view can present a modal view

Any view can present a modal view

Up until now, we’ve presented new views using our Navigation Controller. Things are a little different for modal views: any UIViewController can show a modal view, then dismiss it when necessary. To display a modal view on top of the current view, simply send the current view the presentModalView Controller:animated: message. Since our RootViewController is the View Controller that needs to show the modal view, we can just send this message to ourselves, using self, like this:

image with no caption

Sharpen your pencil

Update the RootViewController.m file to display our AddDrinkViewController when the + button is tapped.

Import the AddDrinkViewController.h so the RootViewController knows what class you’re talking about.


  

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