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]; }

  • 相关阅读:
    Socket
    字符串,byte,字典转换整理
    1-嵌入式面试题库
    10-FreeRTOS 队列
    9-FreeRTOS API获取任务使用CPU时间
    7-代码区 | 常量区 | 静态区(全局区) | 堆区 | 栈区
    8-FreeRTOS任务API
    7-FreeRTOS时间片进行任务调度
    6-C指针
    用Union体测试处理器大小端
  • 原文地址:https://www.cnblogs.com/bmate/p/3183354.html
Copyright © 2011-2022 走看看