从右到左不按或呈现视图控制器



是否有可能在没有push or Persenting视图控制器的情况下从Right To Left执行segue。以下代码在动画中工作正常,但是如果我使用此类,则隐藏TabBar。如果我删除Perform()TabBar内的代码显示但动画停止 使用MDCBottomNavigationBar

class SegueFromRight: UIStoryboardSegue {
override func perform() {
let src = self.source
let dst = self.destination
src.view.superview?.insertSubview(dst.view, aboveSubview: src.view)
dst.view.transform = CGAffineTransform(translationX: src.view.frame.size.width, y: 0)
UIView.animate(withDuration: 0.25,delay: 0.0,options: UIView.AnimationOptions.curveEaseInOut,animations: {
dst.view.transform = CGAffineTransform(translationX: 0, y: 0)
},completion: { finished in
src.navigationController?.pushViewController(dst, animated: false)
}
)
}
}

有没有其他方法可以在不隐藏TabBar的情况下使用动画执行 segue ?

终于找到了答案。只是删除行Push ViewController

class SegueFromRight: UIStoryboardSegue {
override func perform() {
let src = self.source
let dst = self.destination
src.view.superview?.insertSubview(dst.view, aboveSubview: src.view)
dst.view.transform = CGAffineTransform(translationX: src.view.frame.size.width, y: 0)
UIView.animate(withDuration: 0.25,delay: 0.0,options: UIView.AnimationOptions.curveEaseInOut,animations: {
dst.view.transform = CGAffineTransform(translationX: 0, y: 0)
},completion: { finished in
//Remove Following line if you want to segue modally  
//src.navigationController?.pushViewController(dst, animated: false)
}
)
}
}

试试这个

private func setupAlwaysVisibleView() {
guard let tabBarController = self.tabBarController else { return }
tabBarController.view.insertSubview(alwaysVisibleView, belowSubview: tabBarController.tabBar)
}

相关内容

  • 没有找到相关文章

最新更新