2
votes

I have a very basic view controller class, created via interface builder. it only has one view, which is a UIWebView (see here: http://i55.tinypic.com/xdax01.png).

Somewhere in my app i want to open this view controller as modal dialog via presentModalViewController. This is my code to achieve this:

self.viewController.modalPresentationStyle= UIModalPresentationFormSheet;

WebController* dvc= [[WebController alloc] initWithNibName:@"WebController" bundle:nil];

[self.viewController presentModalViewController:dvc animated:YES];

The modal dialog is shown, but unfortunately it is shown full screen, instead of the smaller dimensions of UIModalPresentationFormSheet. When i replace the above code with this one:

self.viewController.modalPresentationStyle= UIModalPresentationFormSheet;

MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];

[self.viewController presentModalViewController:mailViewController animated:YES];

The app will correctly show a modal dialog with form sheet size (not fullscreen).

What do i have to do in order to present my view controller class in the smaller form sheet size instead of fullscreen?

1

1 Answers

4
votes

modalPresentationStyle applies to the presented view controller and not the hosting view controller. So in your case you must do this:


dvc.modalPresentationStyle=UIModalPresentationFormSheet;