ios - CapsPageMenu 隐藏 TableView 上的 NavigationBar 从子 UIViewController 滚动不工作

标签 ios swift uitableview uinavigationcontroller uinavigationbar

我正在使用以下库在我的应用中创建标签

https://github.com/PageMenu/PageMenu

子 UIViewControllers 有 tableview 我想从 subview Controller 隐藏 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)
    }
}

最佳答案

设置子 Controller View 框架使用,

newVC.view.frame = CGRect(x: self.view.frame.width * CGFloat(index), y: menuHeight, width: self.view.frame.width, height: self.view.frame.height)

相反,

newVC.view.frame = CGRect(x: self.view.frame.width * CGFloat(index), y: menuHeight, width: self.view.frame.width, height: self.view.frame.height-menuHeight)

CAPSPageMenu 类的 func addPageAtIndex(_ index : Int) 内部

关于ios - CapsPageMenu 隐藏 TableView 上的 NavigationBar 从子 UIViewController 滚动不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58950139/

相关文章:

ios - 使用组合字符串从 url 快速加载图像

iphone - 如何随着值的变化增加和减少 uislider 中的圆圈大小

ios - AFNetworking 后置参数未编码

View Controller 中的 iOS 动态 View

ios - Tableview重新加载数据将数字恢复为默认值

ios - 如何在uitableview中搜索并显示youtube视频?

swift - 如何处理响应式(Reactive)编程更新和CollectionView

ios - 如何在显示 tableview 单元格之前显示占位符?

iOS UITableView 如何禁用滚动到底部弹跳

ios - Adobe Air IOS 中的黑色边框