首页 > 其他 > 详细

UITableView学习笔记

时间:2015-05-31 10:40:22      阅读:228      评论:0      收藏:0      [点我收藏+]

要让 UITableViewController 实现 UITableViewDataSource 协议,需要实现以下方法:

1. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;

指定section数

所谓的section,我目前的理解,就是类似通讯录里面的按照首字母分块A、B、C

 

2. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;

指定每个section的row数

 

3. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

指定对应cell的内容

初始化cell有两种方法:

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ToDoEventCell" forIndexPath:indexPath];

UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"ToDoEventCell"];

 

UITableView学习笔记

原文:http://www.cnblogs.com/mobilefeng/p/4541520.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!