简体   繁体   English

呈现为.OverCurrentContext的UIViewController呈现为.CrossDissolve不透明

[英]UIViewController presented with .OverCurrentContext is opaque with .CrossDissolve

I am trying to get the familiar "translucent overlay" effect. 我正在尝试获得熟悉的“半透明覆盖”效果。 I am using the .OverCurrentContext presentation style, and the presented VC has a view with 0.5 alpha, set in storyboard. 我正在使用.OverCurrentContext表示样式,并且所提供的VC具有一个在情节提要中设置的具有0.5 alpha的视图。

When I use the (default) transition of .CoverVertical, all is good. 当我使用.CoverVertical的(默认)过渡时,一切都很好。 When I use .CrossDissolve (which is what I want) the presented view is opaque. 当我使用.CrossDissolve(这是我想要的)时,显示的视图是不透明的。 When I check the presented view's alpha, it has somehow become 1. Why? 当我检查呈现的视图的Alpha值时,它以某种方式变为1。为什么? Where do I intercede to prevent this? 我在哪里可以阻止这种情况发生?

let vc = self.storyboard!.instantiateViewControllerWithIdentifier("Overlay")!
vc.modalPresentationStyle = .OverCurrentContext
vc.modalTransitionStyle = .CrossDissolve
self.presentViewController(vc, animated:true, completion:nil)

Where do I intercede to prevent this? 我在哪里可以阻止这种情况发生?

You intercede in the whole animation. 您可以干预整个动画。 You're going to have to do a custom transition animation for your view controller presentation, because what you want to do is not covered by any of the four or five standard animations. 您将必须为视图控制器演示做一个自定义过渡动画,因为您要执行的操作没有被四个或五个标准动画中的任何一个覆盖。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM