tableview侧滑删除
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == ) {
return NO;
}
return YES;
} - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
return UITableViewCellEditingStyleDelete;
} - (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
{
return @"删除";
} - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
NSInteger index = (indexPath.section-);
Address *address = [self.addressArray objectAtIndex:index]; //联网删除地址
[SVProgressHUD showWithStatus:@"正在删除.."];
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:address.AddressID, @"AddressID", nil];
[self.afServiceHelper getDefaultJsonWithSubMethod:@"AddressInfo_AddressID_Delete" parameters:dict cachePolicy:NSURLRequestUseProtocolCachePolicy success:^(id json) {
[SVProgressHUD dismiss];
NSDictionary *resultDict = json;
if ([[resultDict objectForKey:M_Code] integerValue] == ) {
[self.addressArray removeObjectAtIndex:index];
NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:indexPath.section];
[tableView deleteSections:indexSet withRowAnimation:UITableViewRowAnimationLeft];
} else {
[self.tableView makeToast:[resultDict objectForKey:M_Msg] duration:1.0 position:@"center"];
} } failure:^(NSError *error, NSString *msg) {
if(error.code == NSURLErrorNotConnectedToInternet) {
[SVProgressHUD dismiss];
[self.tableView makeToast:@"没有网络" duration:1.0 position:@"center"];
} else {
[SVProgressHUD dismissWithError:@"删除失败"];
}
}]; }
}
tableview侧滑删除的更多相关文章
- iOS tableView侧滑删除的第三方控件
(到我的文件中,下载“tableview中cell测滑删除的第三方控件”),使用方法如下: 在tableView中的.m中,设置cell的方法上,事例代码如下,其中,EaseConversationC ...
- 有关UITableViewCell的侧滑删除以及使用相关大神框架MGSwipeTableCell遇到的小问题
提起笔,却不知道从何写起了,今天一整天都耗费在了这个可能根本不算是问题的小问题上,至今仍有一种蛋蛋的忧桑..(噢,不是提笔,是键盘手T_T) 表格视图在项目中就像是每日的家常便饭,在cell上添加侧滑 ...
- 自定义UITableview自带侧滑删除按钮样式 by 徐
效果如下: 实现原理: 1.打开tableview自带的侧滑删除功能 核心代码: 1 -(void)tableView:(UITableView *)tableView commitEditingSt ...
- 史上最简单,一步集成侧滑(删除)菜单,高仿QQ、IOS。
重要的话 开头说,not for the RecyclerView or ListView, for the Any ViewGroup. 本控件不依赖任何父布局,不是针对 RecyclerView. ...
- QQ视差特效和ListView侧滑删除
如图所示是效果图,当向下拉时,图片会被拉出来,松手后恢复.和ListView的侧滑删除 1.视差特效 首先图片是通过addHeaderView加上去的,所以在设置Adapter前先设置一个View ...
- tableView里删除单元格
tableView里删除单元格 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSInde ...
- 记一个SwipeMenuListView侧滑删除错乱的Bug
做侧滑删除网上有很多方案,比如重写Listview实现滑动的监听,今天说下一个SwipeListView,这个是之前一个朋友在网上开源的一个封装组件,能够适用于多种情况,项目地址:https://gi ...
- Android实现RecyclerView侧滑删除和长按拖拽-ItemTouchHelper
RecyclerView这个被誉为ListView和GirdView的替代品,它的用法在之前的一篇博文中就已经讲过了,今天我们就来实现RecyclerView的侧滑删除和长按拖拽功能,实现这两个功能我 ...
- android--------ListView和ExpandableListView的侧滑删除操作
本案例主要实现了ListView和ExpandableListView的侧滑删除操作功能 效果图: ListView的Adapter类 private class SlideAdapter exten ...
随机推荐
- js024-最佳实践
js024-最佳实践 本章内容: 可维护的代码 保证代码性能 部署代码 24.1 可维护性 24.1.1 代码的可维护性 代码可维护性的特征: 特性 说明 可理解性 其他人可以理解它的用途和一般途径 ...
- windows7-PowerDesigner 15.1 的安装图解
下载 PowerDesigner 15.1 的安装文件和破解文件 破解文件下载地址:http://pan.baidu.com/share/link?shareid=177873&uk=3626 ...
- centos Apache、php、mysql默认安装路径
apache: 如果采用RPM包安装,安装路径应在 /etc/httpd目录下 apache配置文件:/etc/httpd/conf/httpd.conf Apache模块路径:/usr/sbin/a ...
- /etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc 的区别(转)
/etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行并从/etc/profile.d目录的配置文件中搜集shell的设置. /etc/bashrc:为每一个运 ...
- Understanding Convolutions
http://colah.github.io/posts/2014-07-Understanding-Convolutions/ Posted on July 13, 2014 neural netw ...
- Which is the best opencv or matlab for image processing?
http://www.researchgate.net/post/Which_is_the_best_opencv_or_matlab_for_image_processing Annette Mor ...
- 最近这么火的iOS视频直播
快速集成iOS基于RTMP的视频推流 http://www.jianshu.com/p/8ea016b2720e iOS视频直播初窥:高仿<喵播APP> http://www.jiansh ...
- 合并两个结构完全相同的DataTable
两个结构一模一样的DataTable如何合并? 例子:使用Winform进行演示,表2的数据为固定的,表1的数据可以动态添加,通过合并按钮合并表1和表2的数据到表3 1.规定公共的DataTable结 ...
- 关于高性能Web服务的一点思考
下面这些概念对于专业做性能测试的会比较熟悉,但是对于开发人员不一定都那么清楚. 并发用户数: 某一时刻同时请求服务器的用户总数,通常我们也称并发数,并发连接数等. 吞吐率:对于web服务器来说就是每秒 ...
- SQL补充
TOP 子句TOP 子句用于规定要返回的记录的数目.对于拥有数千条记录的大型表来说,TOP 子句是非常有用的.注释:并非所有的数据库系统都支持 TOP 子句.SELECT TOP 2 * FROM P ...