效果
附上代码
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
GoViewController *goVC= [[GoViewController alloc]init];
[UIView beginAnimations:nil context:NULL];
//设置动画块中的动画属性的变化的曲线
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
//设置持续时间
[UIView setAnimationDuration:0.5];
/**
UIViewAnimationTransitionNone, 不使用动画
UIViewAnimationTransitionFlipFromLeft, 从左向右翻转
UIViewAnimationTransitionFlipFromRight, 从右向左翻转
UIViewAnimationTransitionCurlUp,卷曲翻页, 从下往上
UIViewAnimationTransitionCurlDown, 卷曲翻页, 从上往下
*/
//设置过度的动画效果
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO];
[self.navigationController pushViewController:goVC animated:YES];
//提交动画
[UIView commitAnimations];
}
第二种方式:
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
GoViewController *goVC= [[GoViewController alloc]init];
goVC.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentViewController:goVC animated:YES completion:nil];
}