我正在使用以下代码:
FirstView * fir=[[FirstView alloc]init];
[self.navigationController pushViewController:fir animated:NO];
我想做一个像popview控制器这样的动画。
提前致谢。
-(void)ButtonAction:(id)sender{
[self SwipeRight:self.navigationController.view]; // <--calling method
//[self.navigationController pushViewController:viewcontrollerobject animated:NO];
// or pop //
}
-(void)SwipeRight:(UIView *)view{
CATransition* transition = [CATransition animation];
[transition setDuration:0.3];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromRight;
[transition setFillMode:kCAFillModeBoth];
[transition setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[view.layer addAnimation:transition forKey:kCATransition];
}
-(void)SwipeLeft:(UIView *)view{
CATransition* transition = [CATransition animation];
[transition setDuration:0.3];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromLeft;
[transition setFillMode:kCAFillModeBoth];
[transition setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[view.layer addAnimation:transition forKey:kCATransition];
}