控制器跳轉(zhuǎn)動畫

https://github.com/soberZhichao/presentNextPageAnimation

- (IBAction)nextPageClick:(id)sender
{
    // UIStoryboard讀取VC
    UIViewController *nextVC = [[UIStoryboard storyboardWithName:@"NextViewController" bundle:nil] instantiateViewControllerWithIdentifier:@"NextViewController"];
    
//    vc自帶的跳轉(zhuǎn)modal
//    nextVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    
    [self setupPresentAnimation];
    
    [self presentViewController:nextVC animated:NO completion:nil];
    
}

- (void)setupPresentAnimation
{
    //創(chuàng)建動畫
    CATransition *animation = [CATransition animation];
    //設(shè)置運動軌跡的速度     iOS5之后新的寫法,以前的不再支持
    animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
    //設(shè)置動畫類型為立方體動畫
    animation.type = @"cube";   // 詳細(xì)動畫方式可見我的CALayer  跳轉(zhuǎn)動畫那篇
    //設(shè)置動畫時長
    animation.duration = 2;
    //設(shè)置運動的方向
    animation.subtype =kCATransitionFromRight;
    //控制器間跳轉(zhuǎn)動畫
    [[UIApplication sharedApplication].keyWindow.layer addAnimation:animation forKey:nil];
}
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容