zoukankan      html  css  js  c++  java
  • 如何让 UITableView 的 headerView跟从 cell一路迁移转变



            1。 所以我就把它 作为一个section的 headerView。 
            也就是在函数:
            - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
            里面返回 这个UIView。
            然则,因为这个UIView占的空间很大,根蒂根基占用全部屏幕的高度,而迁移转变tableView的时辰,只迁移转变cell的内容,而这个section的
    headerView却不跟着迁移转变。
            后面,我想出了办法2。
     
           2。  设置 tableView的 style为  UITableViewStyleGrouped,然后让
              - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
           返回1。
            如许确切可以让 headerView ,在迁移转变tableView的时辰,跟从着cell的内容一路迁移转变。然则,我发明,下面的cell都被加上了边框,
            并且cell的程度显示局限变窄了。
            所以测验测验了办法3。


           3。  将UIView设置为  全部tableView的headerView,而不是 section 0的headerView
                   self.tableView.tableHeaderView=header;
                 如许,就可以完美的满足 headerView跟从cell的内容一路迁移转变的请求拉。
     
         结论:设置 UIView为  tableView的tableHeaderView即可实现 headerView跟从tableView一路迁移转变的结果。

  • 相关阅读:
    《linux 必读》
    ldd ldconfig
    rpm 数据库
    /bin, /sbin & /usr/bin, /usr/sbin & /usr/local/bin, /usr/local/sbin & glibc
    POSIX
    CentOS 下载地址
    insert into TABLE by SELECT ...
    httpd 处理模型
    http 状态码
    IP地址 0.0.0.0 是什么意思?
  • 原文地址:https://www.cnblogs.com/zhwl/p/2849696.html
Copyright © 2011-2022 走看看