My approach was to use / create different subclasses of the UIViewController for each of the two types of presentations. Quite often, they can share a common superclass. Here is an example:
@interface CMDetailsViewController : UIViewController @end @interface CMDetailsSinglePageViewController : CMDetailsViewController @end @interface CMDetailsPopoverViewController : CMDetailsViewController @end
Each of these two classes can customize some of the types of behavior defined in your base class. In your case, it will be presentation logic, which, I believe, is in one of the appearance methods (for example, -(void)viewWillAppear:(BOOL)animated or alternative) or -(void)viewDidLoad .
As you definitely know how you represent the view controller: using let UINavigationController (on the iPhone) or UIPopoverController (on the iPad), you can decide which of these two subclasses to create.
All in all, this is my default approach when I work on a generic iOS application. The system allows you to define 2 different UIApplicationDelegates for each platform, which means that you can use the corresponding UIViewControllers without having a ton of if-else to check the device on which the application was run.
Dmitry Makarenko
source share