Refresh the page view lead controller

Instructions

PageVC

// viewControllers: a sub-controller 
// headerView: first view 
// pageTitleView: menu bar 
// viewHeight: pageVC height, when other space at the bottom, through which is controlled 
pageVC = LXPageViewController.init (viewControllers: controllers, headerView: headView !, pageTitleView: the titleView !, a viewHeight that is: view.frame.height) 
!! = Self pageVC .delegate the addChild (pageVC) view.addSubview (pageVC .view)!
'' '

Sub-controller:

1. inherited LXChildViewController
2. override the parent class property

override var offsetY: CGFloat { 
  set {
    tableView!.contentOffset = CGPoint(x: 0, y: newValue)
  }
  
  get
{
    return tableView!.contentOffset.y }
  }

override var isCanScroll: Bool {
  didSet {
    if isCanScroll {
      tableView!.setContentOffset(CGPoint(x: 0, y: offsetY), animated: false)
    }
  }
}

3. Implementing a proxy method

 func scrollViewDidScroll(_ scrollView: UIScrollView) { 
  scrollDelegate?.lxChildViewController(self, scrollViewDidScroll: scrollView)
}

 

Guess you like

Origin www.cnblogs.com/liuluoxing/p/11743725.html