【发布时间】:2013-10-29 11:21:51
【问题描述】:
在 iOS 7 之前,根据这个流行的 Stackoverflow question,,显示具有清晰背景的 ViewController 的方法是在主 ViewController 中执行以下操作:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"SecondViewController"];
vc.view.backgroundColor = [UIColor clearColor];
self.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentViewController:vc animated:NO completion:nil];
但是,正如我最近在 iOS 7 中发现的(以及其他人对主要答案的评论),上述解决方案不再有效,而只是显示了一个黑色模型控制器。我知道透明度在 iOS 7 中主要使用,因此透明视图控制器很可能是可能的。我还没有找到解决这个问题的方法,想知道是否有人知道如何解决这个问题。谢谢!
【问题讨论】:
-
modalPresentationStyle文档现在指出:“在 iPhone 和 iPod touch 上,模态视图控制器总是全屏呈现,但在 iPad 上有几种不同的呈现选项”。所以我认为 Apple 在 iOS 7 中为 iPhone 取消了这个功能。 -
这个stackoverflow.com/q/27598846/1603234让我微笑,现在轮到你了:)
标签: iphone ios ios7 transparency