• UITableView的详细使用


    首先创立  tableView

    UITableView *tableView = [[UITableView alloc] initWithFrame:[UIScreen mainScreen].bounds style:UITableViewStyleGrouped];

        [self addSubview:tableView];

     

     

    #pragma mark 设置TableView上面显示的内容 使用此方法时候需要注意,一定要使用重用机制,否则会出现文字或图像重叠的现象

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;

    #pragma mark - 重写----设置有多少个分组

    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;

    #pragma mark - 重写----设置每个分组上面有多少单元格

    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;

    #pragma mark - 重写---修改行高

    - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {

        return 44; // 返回多少即设置行高为多少

    }

    #pragma mark - 重写----设置单元格分组的标题和标注的高度

    #pragma mark 设置分组上面的标题的高度

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

    #pragma mark 设置分组下面的标注的高度

    - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section;

  • 相关阅读:
    测试用户网速办法
    JS 判断后端返回的对象是否为空
    优美地低于生活——读书笔记
    vue login.js登录逻辑
    vuex store index.js配置登录
    vue router的 index.js设置
    css 添加校验时的必填项前面的红色的*
    vue 的 main.js 设置
    vue.config.js配置
    vim的使用
  • 原文地址:https://www.cnblogs.com/lhp-1992/p/4634468.html
Copyright © 2020-2023  润新知