在4.2.1中,ipad页面/表单模态视图不再透明

时间:2010-11-25 05:56:07

标签: ipad modal-dialog

在我的应用程序中,我一直在使用页面和表单模式视图控制器,如下所示:

quickTemplateViewer.modalPresentationStyle = UIModalPresentationPageSheet;
quickTemplateViewer.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[parent presentModalViewController:myView animated:YES];

我有一个偏移关闭按钮,它悬挂在左上方的视图上(视图略小于指定的模态视图大小),并且由于hte模态视图的背景部分透明,因此它一直运行良好。

我升级到4.2.1并且突然而不是带有投影的半透明黑色背景我有一个带圆角的白色背景。是否有新的设置将其恢复透明?

由于

1 个答案:

答案 0 :(得分:1)

我整天都在寻找解决方案,并最终放弃并制定了自己的解决方案。

基本上我所做的不是使用presentModalViewController加载我的'modal',而是添加了一个全尺寸视图,其中黑色backgroundColor具有80%的不透明度,因此它显示了一个稍微变暗的视图。

在这个视图的内部,我添加了一个视图,我通常用presentModalViewController加载适当的X& Y坐标。这样,你模仿UIModalPresentationPageSheet的行为:你得到一个暗淡的背景,用户不能使用下面的任何UIControl。

它可能不是最好的实现,但它是我能想到的最好的。希望类似的东西适合你们。

- 更新

迈克问我是如何实现通常伴随模态的动画。基本上,我使用的是UIView animationTransition:

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:
   UIViewAnimationTransitionFlipFromLeft forView:anotherView cache:YES];
[mainContainer addSubview:modal.view];
[UIView commitAnimations];