zoukankan      html  css  js  c++  java
  • 关于UITableView的若干方法-15-05-07

     1—   self.carTableView.dataSource = self;    

              ——要设置数据源才能进行对列表相关设置。

    2—-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView  

              ———设置总的有几组数据

    3—-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section  

              ————设置第section组有几个数据

    4—-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath   

              ——设置indexpath的数据,其中indexpath为结构体,有section和row成员

    5—    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];  

    6—  UITableViewCell *cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];

              ——新建类型为UITableViewCellStyleSubtitle,标识为ID的cell

    7— 类型为UITableViewCellStyleSubtitle的UITableViewCell有三个成员可以进行图片,文本,详细文本的赋值。imageView——textLabel ——detailTextLabel

                   UITableViewCell内部有个默认的子视图:contentView,以上均为contentview的子控件。

    8—-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath  

              ——当列表中某行被点击时会调用该代理方法。

    9— - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView

              ——代用该方法会生成右边索引条

    补充——辅助指示视图的作用是显示一个表示动作的图标,可以通过设置UITableViewCell的accessoryType来显示

              ——从缓存中取出标识为ID的UITableViewCell的内存,进行重新赋值

  • 相关阅读:
    [Java入门] 从键盘输入两个整数,求最小公倍数并输出
    【C#食谱】【面食】菜单3:用泛型替代ArrayList
    C# Stable Sort(稳固排序)
    【C#食谱】【面食】菜单4:List和LinkedList性能比较
    一个非常酷的应用:修改“开始”菜单的显示文本
    我的第一个5年计划
    C#语言重要常识
    决定执行力的49个细节
    .NET资源链接
    标准表达式中数据类型不匹配(Access 时间格式)
  • 原文地址:https://www.cnblogs.com/tusiji7/p/4486327.html
Copyright © 2011-2022 走看看