zoukankan      html  css  js  c++  java
  • UITableView的HeaderView和FooterView

    header通过下面两个代理方法设置

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

    - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section

    footer通过下面两个

    - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
    - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section

    如果要做整个tableview的header和footer,要通过tableview setHeaderView setFooterView

    如果只是指定每个section的title,只需要tableView的dataSource的实现下面的方法来返回每个section的title

    - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section

    -(UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section

    是用来自定义每个section的headView

    如果是要自定义每个section的headView用第二个方法创建自定用的视图并返回。

    -(UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {

    if(section == 0) { CustomView *view = [[CustomeView alloc] init]; return [view autorelease]; }

  • 相关阅读:
    spring-data-elasticsearch (elasticsearch 6.7.0) @Document 和 @Field 注解详解
    干货链接(大神)
    Excel word PDF导入导出 Easy POI
    helm 源大集合
    K8s学习干货
    K8S
    阳明大神---容器时代
    K8s高可用集群部署
    最小 docker_lpnm系统
    python 协程和异步编程全解
  • 原文地址:https://www.cnblogs.com/bmate/p/3183354.html
Copyright © 2011-2022 走看看