zoukankan      html  css  js  c++  java
  • UITableViewCell 左滑删除

    1. - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { 
    2.     return YES; 
    3.   
    4. - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { 
    5.   
    6.      if (editingStyle == UITableViewCellEditingStyleDelete) { 
    7.          [dataArray removeObjectAtIndex:indexPath.row]; 
    8.          // Delete the row from the data source. 
    9.          [testTableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; 
    10.           
    11.      }    
    12.      else if (editingStyle == UITableViewCellEditingStyleInsert) { 
    13.      // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view. 
    14.      }  
    15.  } 
     按理说故事讲到这里也就讲完了.但是笔者想延伸一下.注意看图二划动以后的"Delete",你有没有想把这个东东改掉的冲动呢?比如改成:下载?其实很简单,其实下面这个代理方法:
     
    1. - (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath{ 
    2.         return @"下载"; 
  • 相关阅读:
    关于 <customErrors> 标记的“mode”属性设置为“Off”的问题的解决方案
    ASP.NET MVC的帮助类HtmlHelper和UrlHelper
    js判断手机浏览器操作系统和微信浏览器的方法
    javascript倒计时代码及倒计时弹窗
    修改UISearchBar背景色
    dispatch_group_async
    Block 代替for循环
    GCD 延时操作
    GCD 倒计时
    创建UIButton
  • 原文地址:https://www.cnblogs.com/CodingMann/p/4977905.html
Copyright © 2011-2022 走看看