简体   繁体   中英

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.

When I use the (default) transition of .CoverVertical, all is good. When I use .CrossDissolve (which is what I want) the presented view is opaque. When I check the presented view's alpha, it has somehow become 1. Why? 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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