如何在IOS中使用UITableView删除表格单元
这篇文章将为大家详细讲解有关如何在IOS中使用UITableView 删除表格单元,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。

创新互联秉承实现全网价值营销的理念,以专业定制企业官网,成都网站制作、成都网站建设、外贸营销网站建设,重庆小程序开发,网页设计制作,手机网站开发,全网营销推广帮助传统企业实现“互联网+”转型升级专业定制企业官网,公司注重人才、技术和管理,汇聚了一批优秀的互联网技术人才,对客户都以感恩的心态奉献自己的专业和所长。
实现代码:
- (void)tableView:(UITableView *)aTableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
NSDictionary *section = [data objectAtIndex:indexPath.section];
if (section) {
NSMutableArray *content = [section valueForKey:@"content"];
if (content && indexPath.row < [content count]) {
[content removeObjectAtIndex:indexPath.row];
}
}
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
else if (editingStyle == UITableViewCellEditingStyleInsert) {
NSDictionary *section = [data objectAtIndex:indexPath.section];
if (section) {
// Make a local reference to the editing view controller.
EditingViewController *controller = self.editingViewController;
NSMutableArray *content = [section valueForKey:@"content"];
// A "nil" editingItem indicates the editor should create a new item.
controller.editingItem = nil;
// The group to which the new item should be added.
controller.editingContent = content;
controller.sectionName = [section valueForKey:@"name"];
controller.editingTypes = [section valueForKey:@"types"];
[self.navigationController pushViewController:controller animated:YES];
}
}
}关于如何在IOS中使用UITableView 删除表格单元就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。
新闻名称:如何在IOS中使用UITableView删除表格单元
网站地址:http://www.cqwzjz.cn/article/jcheeg.html


咨询
建站咨询
