我有一个非常基本的视图控制器类,是通过接口构建器创建的。它只有一个视图,那就是一个UIWebView (查看这里:http://i55.tinypic.com/xdax01.png)。
在我的应用程序中的某个地方,我想通过presentModalViewController将这个视图控制器作为模式对话框打开。这是我的代码来实现这一点:
self.viewController.modalPresentationStyle= UIModalPresentationFormSheet;
WebController* dvc= [[WebController alloc] initWithNibName:@"WebController" bundle:nil];
[self.viewController presentModalViewController:dvc animated:YES];显示了模式对话框,但不幸的是,它是全屏显示的,而不是较小尺寸的UIModalPresentationFormSheet。当我用下面的代码替换上面的代码时:
self.viewController.modalPresentationStyle= UIModalPresentationFormSheet;
MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
[self.viewController presentModalViewController:mailViewController animated:YES];该应用程序将正确显示模式对话框与表单大小(而不是全屏)。
我要怎么做才能让我的视图控制器类以较小的表单页大小而不是全屏显示?
发布于 2011-09-23 19:10:48
modalPresentationStyle应用于呈现的视图控制器,而不是宿主视图控制器。因此,在您的情况下,您必须这样做:
dvc.modalPresentationStyle=UIModalPresentationFormSheet;https://stackoverflow.com/questions/7528015
复制相似问题