- (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侧滑删除的更多相关文章

  1. iOS tableView侧滑删除的第三方控件

    (到我的文件中,下载“tableview中cell测滑删除的第三方控件”),使用方法如下: 在tableView中的.m中,设置cell的方法上,事例代码如下,其中,EaseConversationC ...

  2. 有关UITableViewCell的侧滑删除以及使用相关大神框架MGSwipeTableCell遇到的小问题

    提起笔,却不知道从何写起了,今天一整天都耗费在了这个可能根本不算是问题的小问题上,至今仍有一种蛋蛋的忧桑..(噢,不是提笔,是键盘手T_T) 表格视图在项目中就像是每日的家常便饭,在cell上添加侧滑 ...

  3. 自定义UITableview自带侧滑删除按钮样式 by 徐

    效果如下: 实现原理: 1.打开tableview自带的侧滑删除功能 核心代码: 1 -(void)tableView:(UITableView *)tableView commitEditingSt ...

  4. 史上最简单,一步集成侧滑(删除)菜单,高仿QQ、IOS。

    重要的话 开头说,not for the RecyclerView or ListView, for the Any ViewGroup. 本控件不依赖任何父布局,不是针对 RecyclerView. ...

  5. QQ视差特效和ListView侧滑删除

    如图所示是效果图,当向下拉时,图片会被拉出来,松手后恢复.和ListView的侧滑删除   1.视差特效 首先图片是通过addHeaderView加上去的,所以在设置Adapter前先设置一个View ...

  6. tableView里删除单元格

    tableView里删除单元格 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSInde ...

  7. 记一个SwipeMenuListView侧滑删除错乱的Bug

    做侧滑删除网上有很多方案,比如重写Listview实现滑动的监听,今天说下一个SwipeListView,这个是之前一个朋友在网上开源的一个封装组件,能够适用于多种情况,项目地址:https://gi ...

  8. Android实现RecyclerView侧滑删除和长按拖拽-ItemTouchHelper

    RecyclerView这个被誉为ListView和GirdView的替代品,它的用法在之前的一篇博文中就已经讲过了,今天我们就来实现RecyclerView的侧滑删除和长按拖拽功能,实现这两个功能我 ...

  9. android--------ListView和ExpandableListView的侧滑删除操作

    本案例主要实现了ListView和ExpandableListView的侧滑删除操作功能 效果图: ListView的Adapter类 private class SlideAdapter exten ...

随机推荐

  1. eclipse的一些常见操作

    调整字体大小:Window-Preferences-General-Appearance-Colors and Fonts-Basic-Text Font

  2. Lock的用法,为什么要用?

    当多个进程分享数据的时候,对某段程序代码要lock(当对分享数据进行改写的时候). 我们先看些这段代码: namespace ThreadTest { class Program { static b ...

  3. webstorm9.3 安装less 编译css教程

    第一步:安装node.js webstrom9.3汉化下载:http://pan.baidu.com/s/1ntGNNiL    密码:1fbh node.js 下载地址:https://nodejs ...

  4. asp.net js 倒计时总秒数量 和 排序

    Edit in JSFiddle JavaScript HTML CSS Result h1 { font-family: "微软雅黑"; font-size: 40px; mar ...

  5. 利用百度开发者中心的api实现地图及周边的搜索

    <html> <head> <meta http-equiv="Content-Type" content="text/html; char ...

  6. oracle表字段为汉字,依据拼音排序

    在order by后面使用NLSSORT函数转化汉字列,如下 select * from student order by NLSSORT(name,'NLS_SORT=SCHINESE_PINYIN ...

  7. JavaScript排序算法——归并排序

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  8. Hadoop FS shell commands

    命令格式:hadoop fs -command -option args appendToFileUsage: hadoop fs -appendToFile <localsrc> ... ...

  9. GLSL Debugger的姿势

    https://developer.apple.com/library/mac/documentation/GraphicsImaging/Conceptual/OpenGLShaderBuilder ...

  10. Effective Objective-C 2.0 — 第8条:理解“对象等同性”这一概念

    第8条:理解“对象等同性”这一概念 若想检测对象的等同性,请提供“isEqual”与 hash 方法 相同的对象必须具有相同哈希码,但是两个哈希码相同的对象却未必相同. 不要盲目地逐个检测每条属性,而 ...