ios - CATransition fading black during the transition -


i'm performing simple right-to-left transition on 2 view controllers. animation works perfect, , desired result. however, due presenting / presented view controllers fading in / out, black flash in background.

my transition:

let transition = catransition() transition.duration = 2.25 // slow duration see black. transition.type = kcatransitionpush transition.subtype = kcatransitionfromright view.window!.layer.add(transition, forkey: kcatransition) present(vc, animated: false, completion: nil) 

i read setting window color in appdelegate didfinishlaunchingwithoptions can fix this, however, doesn't appear doing anything. (the black still visible during transition.)

self.window!.backgroundcolor = uicolor.white 

any advise on getting 2 vc's transition without black flicker during duration? thanks.

i used have same problem when doing custom transitions did above inside prepare(for:sender:). managed solve after reading a beginner’s guide animated custom segues in ios 8.

inside storyboard select segue, pick custom kind , apply custom seguefrombottom class:

enter image description here

here updated code swift 3.

import uikit  class seguefrombottom: uistoryboardsegue {     override func perform()     {         // assign source , destination views local variables.         let firstvcview = self.source.view uiview!         let secondvcview = self.destination.view uiview!          // screen width , height.         let screenwidth = uiscreen.main.bounds.size.width         let screenheight = uiscreen.main.bounds.size.height          // specify initial position of destination view.         secondvcview?.frame = cgrect(x: 0.0, y: screenheight, width: screenwidth, height: screenheight)          // access app's key window , insert destination view above current (source) one.         let window = uiapplication.shared.keywindow         window?.insertsubview(secondvcview!, abovesubview: firstvcview!)          // animate transition.         uiview.animate(withduration: 0.4, animations: { () -> void in             firstvcview?.frame = (firstvcview?.frame.offsetby(dx: 0.0, dy: -screenheight))!             secondvcview?.frame = (secondvcview?.frame.offsetby(dx: 0.0, dy: -screenheight))!         }, completion: { (finished) -> void in             self.source.present(self.destination uiviewcontroller, animated: false, completion: nil)         })     } } 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -