i have two views,one is aView,another is bView, there is a button on aView,i click the button ,i will jump to bView,please see the code
-(IBAction)jump2b:(id)sender{
CATransition *animation = [CATransition animation];
animation.delegate = self;
animation.duration = 0.25f;
animation.timingFunction = UIViewAnimationCurveEaseInOut;
animation.fillMode = kCAFillModeForwards;
animation.removedOnCompletion = NO;
animation.type = kCATransitionPush;
animation.subtype = kCATransitionFromTop;
[bView.view.layer addAnimation:animation forKey:@"animation"];
}
it can not work well,it can jump,so what can i do?thanks
You forgot to actually add the view at the end…
Is there reason why you’re not using UIView animation blocks? It’s the recommended method for animations since iOS 4. Using UIView’s transitionFromView:toView:duration:options:completion: should work for you…
I used UIViewAnimationOptionTransitionCurlUp as an example for the transition option, but you can choose any UIViewAnimationOption.