본문 바로가기

나의 플랫폼/iOS

[iOS][Swift] NavigationController 화면 전환 시 애니메이션

336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

## CATransition 이용

            let transition = CATransition()

            transition.duration = 0.3

            transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)

            transition.type = kCATransitionFade

            self.navigationController?.view.layer.add(transition, forKey: nil)

            self.navigationController?.pushViewController(targetViewController, animated: false)




## UIView Aniamtion 이용

UIView.animate(withDuration: 0.5, animations: {

            UIView.setAnimationCurve(.easeInOut)

            self.navigationController?.pushViewController(viewController, animated: false)

            UIView.setAnimationTransition( UIViewAnimationTransition.curlUp , for: (self.navigationController?.view)!, cache: false)

        })


참고하세요.