UITableViewDataSource Protocol Reference

Configuring a Table View //配置表格

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath //给予数据源指定indexPath位置的Cell元素(required method)
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView //给予数据源整个table包含的section数,默认为1
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section //给予数据源指定section所包含的Cell数(required method)
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView //给予数据源section的标题列表,与右侧的索引栏有关
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index //给予数据源真实的section与索引列表之间的关系,可以决定哪些section被索引栏引用
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section //给予数据源section的标题,nil为无标题
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section //给予数据源section的尾部标题,nil为无标题

 

Inserting or Deleting Table Rows //插入或删除列

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath //当用户操作tableCell默认的添加或删除按钮时会触发该委托,editingStyle是个枚举,包含UITableViewCellEditingStyleInsert和UITableViewCellEditingStyleDelete
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath //告诉数据源该cell能否启用编辑模式,YES是

Reordering Table Rows //重排表格列

- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath //告诉数据源该cell能否启用重排模式,YES是
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath //告诉数据源指定row移动到什么位置

 

 

posted @ 2013-04-01 16:28  张三的猫  阅读(208)  评论(0编辑  收藏  举报