I have implemented in my code today a CATransition of type cube, as I seen here, CATransition can be added to self.view.layer, so my first question is if I can use my CATransition for switching between viewControllers and not just UIViews?
if I can't do it, please look at this image: http://up411.siz.co.il/up1/hnmim2mtjodt.png as you can see, while the transition is in process, I see the same view of both faces of the cube, I'd like it to be that one face presents view A and the other one presents view B
here is the code if needed :
self.view.layer.addAnimation(createTransition("Right"), forKey: "kCATransition")
func createTransition(side:String) -> CATransition{
var transition = CATransition()
transition.delegate = self
transition.duration = 0.6
transition.timingFunction = CAMediaTimingFunction(name: "easeInEaseOut")
transition.type = "cube"
transition.subtype = "from\(side)"
return transition
}
You have to add the same transition to the view layer of the second view controller's view as well.
Apple documentation in the Core Animation Programming Guide:
To perform a transition animation, you create a CATransition object and add it to the layers involved in the transition.