TabBarController?.selectedIndex 上的动画转换?(迅速)

Isa*_*man 5 uitabbarcontroller ios swift

是否可以快速创建自定义tabBarController类来为选项卡之间的编程和交互式转换设置动画?

Saz*_*bal 1

您可以尝试使用选项卡栏选择上的过渡动画

func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {

guard let fromView = selectedViewController?.view, let toView = viewController.view else {
    return false
}

UIView.transition(from: fromView, to: toView, duration: 0.3, options: [.transitionCrossDissolve], completion: nil)
return true }
Run Code Online (Sandbox Code Playgroud)

供参考使用此链接

如何使用 CrossDissolve 幻灯片过渡为选项卡栏选项卡切换设置动画?