ios - TabBarController 上的动画过渡?.selectedIndex 更改? ( swift )

标签 ios swift uitabbarcontroller

是否可以在 swift 中创建自定义 tabBarController 类以动画化选项卡之间的编程和交互式转换?

最佳答案

你可以试试这个在tabbar selecetion上的过渡动画

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 }

引用使用此链接

How to animate Tab bar tab switch with a CrossDissolve slide transition?

关于ios - TabBarController 上的动画过渡?.selectedIndex 更改? ( swift ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30289727/

相关文章:

ios - [ TableView 重新加载数据];在导航回根 Controller 之前不会重新加载

ios - 在 Swift 3 中播放数组中的随机声音

ios - 在 ARKit 水平面上绘制填充多边形

iphone - iPhone Tab Bar应用程序崩溃

ios - HTTP 状态代码 411 - 需要的长度

ios - RestKit/Core Data——重置后备存储中的对象,而不是更新

ios - Mapbox 中的 MKUserTrackingBarButtonItem

ios - 标签栏 Controller 中每个 View 的不同导航项

ios - 当我切换到 TabBarController 内的另一个 ViewController 时,后退按钮不起作用

ios - 如何设置右侧导航栏按钮标题