iOS UITableView~delegate(代理方法)

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

一、UITableViewdelegate实现:

    //每个cell将要呈现时回调

    - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath


    //每个sectionheader将要呈现时回调

    - (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section NS_AVAILABLE_IOS(6_0)


    //每个sectionfooter将要呈现时回调

    - (void)tableView:(UITableView *)tableView willDisplayFooterView:(UIView *)view forSection:(NSInteger)section NS_AVAILABLE_IOS(6_0)


    //每个cell呈现完毕后回调

    - (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath*)indexPath NS_AVAILABLE_IOS(6_0)


    //每个sectionheader呈现完毕后回调

    - (void)tableView:(UITableView *)tableView didEndDisplayingHeaderView:(UIView *)view forSection:(NSInteger)section NS_AVAILABLE_IOS(6_0)


    //每个sectionfooter呈现完毕后回调

    - (void)tableView:(UITableView *)tableView didEndDisplayingFooterView:(UIView *)view forSection:(NSInteger)section NS_AVAILABLE_IOS(6_0)


    //回调设置每行的高度,如果要自适应调整cell的高度,则必须要实现该回调,返回调整后的cell高度

    - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath


    //回调设置每个sectionheader高度,如果要自适应调整header的高度,则必须要实现该回调,返回调整后的header高度

    - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section


    //回调设置每个sectionfooter高度,如果要自适应调整footer的高度,则必须要实现该回调,返回调整后的footer高度

    - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section


    //回调设置每个sectionheader自定义view

    - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section


    //回调设置每个sectionfooter自定义view

    - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section


    //回调设置每行最右边的辅助按钮的样式

    /*

      typedef NS_ENUM(NSInteger, UITableViewCellAccessoryType) {

      UITableViewCellAccessoryNone,                   // don't show any accessory view

      UITableViewCellAccessoryDisclosureIndicator,    // regular chevron. doesn't track

      UITableViewCellAccessoryDetailDisclosureButton, // blue button w/ chevron. tracks

      UITableViewCellAccessoryCheckmark               // checkmark. doesn't track

      };

      */


    - (UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath NS_DEPRECATED_IOS(2_0, 3_0)

   

    //回调设置辅助按钮被点击后的事件

    - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath


    //回调设置某行是否当被点击后处于高亮状态

    - (BOOL)tableView:(UITableView *)tableView shouldHighlightRowAtIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(6_0)


    //回调当某行处于高亮状态时的行为

    - (void)tableView:(UITableView *)tableView didHighlightRowAtIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(6_0)


    //回调当某行失去高亮状态时的行为

    - (void)tableView:(UITableView *)tableView didUnhighlightRowAtIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(6_0)


    //回调某行将要被选中的行为

    - (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath


    //回调某行将要被取消选中的行为

    - (NSIndexPath *)tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(3_0)


    //回调某行已经被选中点击的行为

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


    //回调某行已经取消选中的行为

    - (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(3_0)


    //回调设置某行进入了哪种编辑模式

    - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath


    //回调设置某行进入删除模式的删除按钮名字

    - (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(3_0)


    //回调设置进入编辑模式的行能否缩进

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


    //回调将要进入编辑模式的行为

    - (void)tableView:(UITableView*)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath


    //回调完成编辑模式的行为

    - (void)tableView:(UITableView*)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath


    //回调设置某行的缩进级别

    - (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath


    //回调设置某行被长按是否出现菜单栏

    - (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(5_0)


    //回调设置菜单栏是否显示哪些菜单栏选项

    - (BOOL)tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender NS_AVAILABLE_IOS(5_0)


    //回调点击菜单栏选项触发的事件

    - (void)tableView:(UITableView *)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender NS_AVAILABLE_IOS(5_0)


谢谢!!!


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值