iOS UITableView~datasource(数据源方法)

//联系人:石虎  QQ: 1224614774昵称:嗡嘛呢叭咪哄

一、UITableViewdatasource实现:

//回调获取每个section中的cell的行数

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section


//回调获取每个uitableviewcell,只有当需要显示的celltable的可视区域内才被回调

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


//回调获取tablesection数量

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView


//回调获取table的每个sectionheader标题

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section


//回调获取table的每个sectionfooter标题

- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section


//回调判断指定的cell是否能有编辑状态

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath


//回调判断指定的cell能否被移动当进入编辑模式的时候

- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath


//回调获取table右边的索引栏内容

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


//当点击右边索引栏时执行的回调,可以根据点击的title值返回应该跳到第几个section

- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index


//当所有相关编辑模式的回调,只实现该回调时默认能滑动cell出现删除按钮。当和其他相关的编辑模式回调混合使用分别有移动,插入,删除等功能

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath


//当进入的是移动的编辑模式时,实现该回调进行移动cell和数据的更新

- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath


谢谢!!!


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值