码迷,mamicode.com
首页 > 其他好文 > 详细

关于UITableView的若干方法-15-05-07

时间:2015-05-07 23:41:54      阅读:110      评论:0      收藏:0      [点我收藏+]

标签:

 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];  

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

 

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

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

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

 

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

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

 

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

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

关于UITableView的若干方法-15-05-07

标签:

原文地址:http://www.cnblogs.com/tusiji7/p/4486327.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!