Search code examples
ioscocoa-touchipaduipopovercontrollerios-universal-app

In a Universal App how can you convert or reuse a modal view as a popover?


I have a modal view controller that is displayed using:

[self presentModalViewController:addStoryItem animated:YES];

on the iPhone. I'm converting the app to a Universal App and I want to display the same modal using a popover. There's a really good tutorial on popovers here, but it focuses on creating the popover for iPad from scratch.

Should I create an ~ipad version of the AddStoryItem.xib file and display it as a popover, or can I display the existing sans-~ipad file? Or, should I just create a specific popover for iPad even though the content of the popover is exactly how I want it on the iPad version?

Cheers for the help!


Solution

  • You COULD do either. You could simply use the same one (assuming it has the correct auto-sizing masks, it might not look half bad) but I think Apple would suggest that you create a new one that uses the greater space available on the ipad better and display that one.

    Also of note, Apple strongly discourages full-screen transitions so which ever method you choose, be sure to change the modal presentation style to be one of the ipad-specific modal popovers. Check out this site: http://useyourloaf.com/blog/2010/5/3/ipad-modal-view-controllers.html and the "Modal Presentation Styles" section