zoukankan      html  css  js  c++  java
  • 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;

  • 相关阅读:
    Software Update Services 2.0 概述
    Windows 2000组策略
    Windows 2000 默认安全策略设置
    C语言I博客作业06
    C语言I博客作业08
    C语言I博客作业09
    C语言I博客作业03
    C语言12019级秋季作业第一周作业
    C语言I博客作业02
    C语言I博客作业05
  • 原文地址:https://www.cnblogs.com/lhp-1992/p/4634468.html
Copyright © 2011-2022 走看看