Alan Alan - 1 year ago 113
iOS Question

Change Presentation Type for Modal View?

In storyboard when you draw a Segue to a modal view controller you can select the type of Presentation, Full Screen, Page Sheet, Form Sheet, etc.

I am doing presenting a modal viewcontroller from a XIB, and it's presenting it in full screen. How do I programmatically change it to Page Sheet or Form Sheet?

Answer Source

In the UIViewController (code), you can set how the new UIViewController will be presented. The property you can access:

@property(nonatomic, assign) UIModalTransitionStyle modalTransitionStyle

And the different types:

typedef enum {
   UIModalPresentationFullScreen = 0,
} UIModalPresentationStyle;

In the code:

MyViewController *controllerThatWillBePresented = ...
controllerThatWillBePresented.modalTransitionStyle = // The one you want
[self presentModalViewController:controllerThatWillBePresented animated:YES];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download