页面之间跳转的动画效果

效果

1.gif

附上代码

- (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];

}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容