zoukankan      html  css  js  c++  java
  • UITableView

    属性:

    //设置每一行cell的高度
        self.tableView.rowHeight
    
    //设置每一组头部的高度
        self.tableView.sectionHeaderHeight
    
    //设置每一组尾部的高度
        self.tableView.sectionFooterHeight 
    
    //设置分割线颜色
        self.tableView.separatorColor = [UIColor redColor];
    
    //设置分割线样式
        self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
    //设置表头控件
        self.tableView.tableHeaderView = [[UISwitch alloc] init];
    
    //设置表尾控件
        self.tableView.tableFooterView = [UIButton buttonWithType:UIButtonTypeContactAdd];
    
    //设置右边索引文字的颜色
        self.tableView.sectionIndexColor = [UIColor redColor];
    
    //设置右边索引文字的背景色
        self.tableView.sectionIndexBackgroundColor = [UIColor blackColor];

    dataSource:

    //遵守协议
    @interface ViewController () <UITableViewDataSource>
    
    @end
    
    //设置数据源
    self.tableView.dataSource = self;
    //实现数据源方法
    
    // 多少组数据
    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;
    
    // 每一组有多少行数据
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
    
    // 每一行显示什么内容
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
    
    // 每一组的头部
    - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section;
    
    // 每一组的尾部
    - (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section

    delegate:

    //选中某一行cell就会调用这个方法
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    
    //取消选中某一行cell就会调用这个方法
    - (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
    
    //返回每一组的头部控件
    - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
    
    //返回每一组的尾部控件
    - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
    
    //返回的每一组的头部的高度
    - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
    
    // 返回的每一组的尾部的高度
    - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
    
    // 返回的每一行cell的高度
    - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

      索引条

    //设置右边索引文字的颜色
         self.tableView.sectionIndexColor = [UIColor redColor];
    
    //设置右边索引文字的背景色
        self.tableView.sectionIndexBackgroundColor = [UIColor blackColor];
    
    //返回每一组的索引标题
        - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
  • 相关阅读:
    ThreadPoolExecutor线程池和ProcessPoolExecutor进程池
    canvas画一个时钟
    js中一些注意点 ps不断更新中....
    javascript文档节点
    Go网络编程
    Goroutine和Channel
    Go单元测试
    简单了解Go语言JSON包
    Go的命令行参数
    Go语言文件操作
  • 原文地址:https://www.cnblogs.com/wwjwb/p/12650831.html
Copyright © 2011-2022 走看看