zoukankan      html  css  js  c++  java
  • UITableView使用

     @自定义cell或headView

       终极封装:

      +(instancetype)headerViewWithTableView:(UITableView *)tableView{

        // 先从缓存池获得headerView

        static NSString *ID = @"header";

        HMHeaderView *headerView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:ID];

        // 没有获得可重用的headerView

        if (headerView == nil) {

            headerView = [[self alloc] initWithReuseIdentifier:ID];

        }

        return headerView;

    }

    @多组数据和多组cell

      1根数组内含数组时,只可以开启一组cell,内含多个数组时,可以开启多组cell

      2多个数组开启多个cell时,既可以竖向开启,也可以横向里层开启,就好比猜题的模式

    @注意点

       1似乎一般情况下,一个控制器只能有一个表格,因为只能实现一套的数据源方法

         如果一定要,必须用另一个控制器控制,再把其表格,搭建上来。

    @数据源方法

      1头部分割区高度

        - (CGFloat )tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section

        注意,如果设置了某组的头部控件,这个高度是会给这组的头部控件

    @八哥积累

      1tableHeaderView不显示?

       原因1:可能没有设置高度,XY和宽度不用设置,设置也没用

                 如果视图有子控件,那么就会有最低高度,不用设置高度也可以

                 如果视图没有子控件,那么必须设置高度。

    @报错积累

      1Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]

       原因:cell返回值为nil时

  • 相关阅读:
    Thymeleaf模板引擎绕过浏览器缓存加载静态资源js,css文件
    LCMapString/LCMapStringEx实现简体字、繁体字的转换。
    java8 LocalDateTime转unix时间戳(带毫秒,不带毫秒)
    关于全角半角
    c++builder 读写文件类
    Unresolved external 'AlphaBlend' referenced from
    GridhEH 选择勾CheckBox
    Variant
    TRegEx 正则表达式
    c++ 字符检测 TCharacter
  • 原文地址:https://www.cnblogs.com/dzq1991/p/6235874.html
Copyright © 2011-2022 走看看