ios - Custom transition from a VC to another VC inside a view -
i have code changes vc vc inside view (containerview). code works, how set transition between both views?
var childvc: uiviewcontroller? @iboutlet weak var containerview: uiview! func changeviewcontroller() { childvc?.willmovetoparentviewcontroller(nil) childvc?.view.removefromsuperview() childvc?.removefromparentviewcontroller() childvc = storyboard?.instantiateviewcontrollerwithidentifier("identifier") as? uiviewcontroller if let childvc = childvc { addchildviewcontroller(childvc) childvc.view.frame = containerview.bounds containerview.addsubview(childvc.view) childvc.didmovetoparentviewcontroller(self) } }
i tried, didnt work:
let oldview = childvc?.view uiview.transitionfromview(oldview!, toview: childvc.view, duration: 2, options: uiviewanimationoptions.transitionflipfromleft, completion: { (succeed) -> void in })
to transition between vcs, can display each vc in view , animate them in , out of view in container view. along these lines:
[uiview beginanimations:nil context:null]; [uiview setanimationduration:1.0]; [uiview setanimationdelegate:self.containerview]; // animations here [uiview commitanimations];
Comments
Post a Comment