(到我的文件中,下载“tableview中cell测滑删除的第三方控件”),使用方法如下:

在tableView中的.m中,设置cell的方法上,事例代码如下,其中,EaseConversationCell继承于LYSideslipCell

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *CellIdentifier = [EaseConversationCell cellIdentifierWithModel:nil];
EaseConversationCell *cell = (EaseConversationCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[EaseConversationCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.consultModel = self.dataArray[indexPath.section];
  //添加侧滑之后的按钮
KDButton *deleteBtn = [cell rowActionWithStyle:LYSideslipCellActionStyleNormal title:nil];
deleteBtn.index = indexPath.row;
deleteBtn.section = indexPath.section;
deleteBtn.backgroundColor =[UIColor redColor];
[deleteBtn setBackgroundImage:kUIImage(@"delete") forState:UIControlStateNormal];
[deleteBtn addTarget:self action:@selector(deleteBtn:) forControlEvents:UIControlEventTouchUpInside];
[cell setRightButtons:@[deleteBtn]];//可以传多个
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}

效果图如下:

(参考代码:美业B端-MYBConsultViewController.m)

其中,这个控件的好处是,可以监听到cell侧滑时的动作,比如需要在侧滑后改变cell的颜色,这个控件就可以实现到,在LYSideslipCell.m中:监控如下这两个方法即可:

- (void)hiddenSideslipButton {
//侧滑恢复后的操作
if (_containLeftConstraint.constant == ) return; [self closeAllOperation];
_containLeftConstraint.constant = _sideslipLeftConstraint.constant = ;
[UIView animateWithDuration:0.2 delay: options:UIViewAnimationOptionCurveLinear animations:^{
[self layoutIfNeeded];
} completion:^(BOOL finished) {
[self openAllOperation];
}];
_backGroundView.backgroundColor = UIColorFromRGB(0xF7F7F7);
_backGroundView.frame = CGRectMake(, , kScreenW - , );
} - (void)showSideslipButton {
//侧滑后的操作
[self closeAllOperation];
_containLeftConstraint.constant = _sideslipLeftConstraint.constant = -CGRectGetWidth(_sideslipView.frame);
[UIView animateWithDuration:0.2 delay: options:UIViewAnimationOptionCurveLinear animations:^{
[self layoutIfNeeded];
} completion:^(BOOL finished) {
for (LYSideslipCell *cell in self.tableView.visibleCells)
if ([cell isKindOfClass:LYSideslipCell.class]) {
cell.userInteractionEnabled = YES;
}
}];
_backGroundView.backgroundColor = UIColorFromRGB(0xE7F8FF);
_backGroundView.frame = CGRectMake(, , kScreenW - , );
}

iOS tableView侧滑删除的第三方控件的更多相关文章

  1. iOS开发无第三方控件的援助达到的效果侧边栏

    最近的研究iOS程序侧边栏.渐渐的发现iOS该方案还开始采取风侧边栏格该,QQ,今日头条,Path(Path运营商最早的侧边栏app该,效果说成是Path效果),所以就研究了下. 然后发现Git Hu ...

  2. IOS中tableView每组的头部控件、通过tableView的代理方法控制某一行的cell能否达到高亮选中状态

    一.tableView每组的头部控件 1.控件宽度默认就是tableView的宽度 2.控件高度由下面的代理方法决定 - (CGFloat)tableView:(UITableView *)table ...

  3. 好用的第三方控件,Xcode插件(不断更新)

    第三方控件类:   1.提示框 MBProgressHUD: 是一款非常强大的.提供多种样式的提示框.使用起来简单.方便.可以在GitHub上查看具体的使用方法. https://github.com ...

  4. 教程-Delphi第三方控件安装卸载指南

    1 只有一个DCU文件的组件.DCU文件是编译好的单元文件,这样的组件是作者不想把源码公布.一般来说,作者必须说明此组件适合Delphi的哪种版本,如果版本不对,在安装时就会出现错误.也正是因为没有源 ...

  5. Delphi7第三方控件

    控件安装(安装时建议先关闭Delphi) 1.只有一个DCU文件的组件. DCU文件是编译好的单元文件,这样的组件是作者不想把源码公布.一般来说,作者必须说明此组件适合Delphi的哪种版本,如果版本 ...

  6. Delphi第三方控件安装卸载指南

    基本安装1.对于单个控件,Componet-->install component..-->PAS或DCU文件-->install; 2.对于带*.dpk文件的控件包,File--& ...

  7. iOS开发UI篇—手写控件,frame,center和bounds属性

    iOS开发UI基础—手写控件,frame,center和bounds属性 一.手写控件 1.手写控件的步骤 (1)使用相应的控件类创建控件对象 (2)设置该控件的各种属性 (3)添加控件到视图中 (4 ...

  8. Delphi7 第三方控件1stClass4000的TfcImageBtn按钮控件动态加载jpg图片例子

    Delphi7 第三方控件1stClass4000的TfcImageBtn按钮控件动态加载jpg图片例子 procedure TForm1.Button1Click(Sender: TObject); ...

  9. delphi使用 第三方控件

    第三方控件安装时必须把所有的pas,dcu,dpk,res等文件复制到你的Lib目录下 然后通过dpk进行安装 安装后会多出来新的控件面板,新控件就在那里了 当然也有一些控件会安装到原有的面板上 比如 ...

随机推荐

  1. 【LeetCode】53.最大子序和

    最大子序和 给定一个整数数组 nums ,找到一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和. 示例: 输入: [-2,1,-3,4,-1,2,1,-5,4], 输出: 6 解释: ...

  2. 我写了个项目,帮你学习HTTP接口测试!

    端午节我写了一个项目,帮助你学习HTTP接口测试. GitHub地址: https://github.com/defnngj/learning-API-test 整个项目基于Flask和 Reques ...

  3. react中antd的表格自定义展开

    antd的表格官方案例中给出的都是固定的图表展开,在做需求的时候,需要使用点击最后一列,然后出现展开内容,实现效果图如下 在最开始设置一个全局变量 const keys = [];在设置列参数的函数中 ...

  4. Django2.2报错 django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.

    准备将 Django 连接到 MySQL,在命令行输入命令 python manage.py makemigrations 后报错: django.core.exceptions.Improperly ...

  5. django自定义错误处理

    要实现自定义错误处理的功能,总共分4步: 1.创建html错误页 2.配置settings ,当DEBUG=True,则不会生效 3.编写视图 4.配置url views.py   def page_ ...

  6. 面向对象软件构造 (Bertrand Meyer 著)

    Part A: The Issues 议题 第一章 软件品质 第二章 面向对象的标准 Part B: The Road To Object Orientation 通向面向对象之路 第三章 模块性 第 ...

  7. 封装cookie的设置和获取

    cookie的设置 function setCookie(key,value,options){ options=options||{}; var time=""; if(opti ...

  8. dirb参数解析

    -----------------DIRB v2.22 By The Dark Raver----------------- dirb <url_base> [<wordlist_f ...

  9. Kafka 入门1

    Kafka 简介 作为一个消息中间件,Kafka 以高扩展性.高吞吐量等特点,在互联网项目中被广泛采用. 不清楚 Kafka 的同学,可以先看看这篇文章: http://blog.csdn.net/s ...

  10. 记录下github 与 gitee 同时使用

    参考 Gitee(码云).Github同时配置ssh key 中间有一步,创建config文件,然后测试就过不去了. 报错:Bad owner or permissions on C:\\Users\ ...