【发布时间】:2020-03-15 22:08:37
【问题描述】:
我正在使用以下库在我的应用中创建标签
https://github.com/PageMenu/PageMenu
子 UIViewControllers 有 tableview 我想从子视图控制器中隐藏 NavigationBar 但它不起作用
我已经尝试过以下事情
self.navigationController?.hidesBarsOnSwipe = true
在上面的代码中添加了子 UIViewController viewWillAppear 方法,并将 NavigationController 从父级传递给子级并调用了上面的代码,但它不起作用。
尝试了下面的另一种方法,在 tableview 滚动上添加了代码,但它在顶部留下了一些空白空间 标签下方
func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
if(velocity.y>0) {
UIView.animate(withDuration: 0.5, delay: 0, options: UIView.AnimationOptions(), animations: {
self.navigateCont.setNavigationBarHidden(true, animated: true)
}, completion: nil)
} else {
UIView.animate(withDuration: 0.5, delay: 0, options: UIView.AnimationOptions(), animations: {
self.navigateCont.setNavigationBarHidden(false, animated: true)
}, completion: nil)
}
}
【问题讨论】:
标签: ios swift uitableview uinavigationcontroller uinavigationbar