iPad + UIWebView + presentModalViewController
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.modalPresentationSt开发者_Python百科yle= 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?
modalPresentationStyle applies to the presented view controller and not the hosting view controller. So in your case you must do this:
dvc.modalPresentationStyle=UIModalPresentationFormSheet;
精彩评论