ios - UIStoryboardSegue sourceViewController above destinationViewController -


i want "slide out" view controller above destinationviewcontroller segue. code:

override func perform() {     let src = self.sourceviewcontroller     let dst = self.destinationviewcontroller      dst.view.superview?.insertsubview(src.view, abovesubview: dst.view)     src.view.transform = cgaffinetransformmaketranslation(0, 0)      uiview.animatewithduration(0.25,         delay: 0.0,         options: uiviewanimationoptions.curveeaseinout,         animations: {             src.view.transform = cgaffinetransformmaketranslation(src.view.frame.size.width * -1, 0)         },         completion: { finished in             src.presentviewcontroller(dst, animated: false, completion: nil)         }     ) } 

the slide looks good, destinationviewcontroller black during animation, when animation completed destinationviewcontroller shown correctly.

how can make display during segue animation?

edit:

solved it:

override func perform() {     let src = self.sourceviewcontroller     let dst = self.destinationviewcontroller      src.view.superview?.insertsubview(dst.view, belowsubview: src.view)     dst.view.transform = cgaffinetransformmaketranslation(0, 0)      uiview.animatewithduration(0.25,         delay: 0.0,         options: uiviewanimationoptions.curveeaseinout,         animations: {             src.view.transform = cgaffinetransformmaketranslation(src.view.frame.size.width * -1, 0)         },         completion: { finished in             src.presentviewcontroller(dst, animated: false, completion: nil)         }     ) } 

try this:

class firstcustomsegue: uistoryboardsegue {      override func perform() {         // assign source , destination views local variables.         var firstvcview = self.sourceviewcontroller.view uiview!         var secondvcview = self.destinationviewcontroller.view uiview!          // screen width , height.         let screenwidth = uiscreen.mainscreen().bounds.size.width         let screenheight = uiscreen.mainscreen().bounds.size.height          // specify initial position of destination view.         secondvcview.frame = cgrectmake(screenwidth, 0.0, screenwidth, screenheight)          // access app's key window , insert destination view above current (source) one.         let window = uiapplication.sharedapplication().keywindow         window?.insertsubview(secondvcview, abovesubview: firstvcview)           // animate transition.         uiview.animatewithduration(0.4, animations: { () -> void in             firstvcview.frame = cgrectoffset(firstvcview.frame, -screenwidth, -0.0)             secondvcview.frame = cgrectoffset(secondvcview.frame, -screenwidth, -0.0)              }) { (finished) -> void in                 self.sourceviewcontroller.presentviewcontroller(self.destinationviewcontroller as! uiviewcontroller,                     animated: false,                     completion: nil)         }     }  } 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -