制作滑动手势动画
问题描述:
我有滑动手势,当我在屏幕右侧或左侧滑动时,在标签栏之间切换其标签栏即时贴 我如何制作它,使其看起来像是向右滑动或左侧标签栏,而不是仅仅瞬间改变标签栏制作滑动手势动画
class SwipeGesture: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let left = UISwipeGestureRecognizer(target: self, action: #selector(swipeLeft))
left.direction = .left
self.view.addGestureRecognizer(left)
let right = UISwipeGestureRecognizer(target: self, action: #selector(swipeRight))
right.direction = .right
self.view.addGestureRecognizer(right)
}
@objc func swipeLeft() {
let total = self.tabBarController!.viewControllers!.count - 1
tabBarController!.selectedIndex = min(total, tabBarController!.selectedIndex + 1)
}
@objc func swipeRight() {
tabBarController!.selectedIndex = max(0, tabBarController!.selectedIndex - 1)
}
}
现在你告诉我,我无法做到这一点在刷卡的姿势,虽然它的工作?!.. – mazenqp
如果我不能这样做,那么我需要从头开始重建我的应用程序我不想要没有豆荚抱歉,我需要代码我知道如何使用它,但我需要代码 – mazenqp