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的内存,进行重新赋值

  • 相关阅读:
    xml
    企业级应用和互联网应用的区别
    javaee学习目标
    数据库基本原理
    数据库学习感想
    数据库设计
    团队项目自我评价
    团队项目-软件度量
    团队项目-初级版本
    团队项目—详细设计
  • 原文地址:https://www.cnblogs.com/tusiji7/p/4486327.html
Copyright © 2011-2022 走看看