使用modalPresentationStyle显示视图

时间:2010-04-22 20:45:45

标签: cocoa-touch ipad view popup

我听说你可以使用modalPresentationStyle在iPad的Mail应用程序中创建一个视图弹出窗口。我很难搞清楚如何使用它。我查看了这篇文章here,仍然无法弄清楚如何完成这项任务。如果有人能解释如何连接控制器以使这个代码工作,那就太好了。

由于

1 个答案:

答案 0 :(得分:12)

我认为神奇的咒语如下:

myViewController = ..... create your new controller if needed ....
myViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
myViewController.modalPresentationStyle = UIModalPresentationFormSheet;
// "self" here is a ViewController instance
[self presentModalViewController:myViewController animated:YES]

我似乎记得,在肖像中,模态接管了屏幕;在景观中,它将以视图为中心呈现。