用diss 实现 push动画
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { AAAViewController * aaa = [[AAAViewController alloc]init]; CATransition * transition = [CATransition animation]; transition.duration = 0.3; transition.type = kCATransitionPush; transition.subtype = kCATransitionFromRight; [self.view.window.layer addAnimation:transition forKey:nil]; [self presentViewController:aaa animated:NO completion:nil]; }
-(void )touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { CATransition * transition = [CATransition animation]; transition.duration = 0.3; transition.type = kCATransitionPush; transition.subtype = kCATransitionFromLeft; [self.view.window.layer addAnimation:transition forKey:nil]; [self dismissViewControllerAnimated:NO completion:nil]; }
用 presentViewController和dismissViewControllerAnimated 实现 pushViewController和popViewControllerAnimated动画