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

UITableView学习笔记

时间:2015-05-31 10:40:55      阅读:94      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!