zoukankan      html  css  js  c++  java
  • 带头视图可刷新分页控制器

    github:https://github.com/alwayns/HeadPageVC

    效果如下图:

    使用方法

    PageVC

    //viewControllers:子控制器
    //headerView:头视图
    //pageTitleView:菜单栏
    //viewHeight:pageVC高度,当底部有其他空间时,通过这个来控制
    pageVC = LXPageViewController.init(viewControllers: controllers, headerView: headView!, pageTitleView: titleView!, viewHeight: view.frame.height) 
    pageVC!.delegate = self addChild(pageVC!) view.addSubview(pageVC!.view)
    '''

    子控制器:

    1.继承LXChildViewController
    2.重写父类属性

    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.实现代理方法

     func scrollViewDidScroll(_ scrollView: UIScrollView) { 
      scrollDelegate?.lxChildViewController(self, scrollViewDidScroll: scrollView)
    }
  • 相关阅读:
    单例模式
    spring boot 调度任务
    linux yum安装MySQL5.6
    day5模块学习--sys模块
    day5模块学习 -- os模块学习
    day5模块学习--random模块
    day5模块学习 -- time、datetime时间模块
    生成随机验证码的方法
    SQL中format()函数对应的格式
    day4作业小代码练习
  • 原文地址:https://www.cnblogs.com/liuluoxing/p/11743725.html
Copyright © 2011-2022 走看看