文章来源:淘论文网   发布者: 毕业设计   浏览量: 30



还可以点击去查询以下关键词:
[UITableView]    [插入]    [定制]    [置顶]    [功能]    [UITableView插入删定制除置顶功能实现]   

项目介绍:

SDLayoutDemo

一个稍复杂的图文混排,开题报告,图片大小不一但又要求图片大小自适应,论文,限制最大宽度,使用indexPath缓存行高。支持cell编辑插入、收藏、点赞、置顶、删除功能。
使用indexPath缓存行高,能够支持90%以上的需求,如果数据计算较为复杂,可以对数据预处理+缓存行高,就相对较好了。
完整的项目在gitHub

如果能够帮助到你,记得给我点个星星✨。谢谢你。哈哈

部分代码如下:

// 插入一行 - (void)InsertRow { if (self.feedEntitySections.count == 0) { [self InsertSection]; } else { [self.feedEntitySections[0] insertObject:self.randomEntity atIndex:0]; NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; [self.tableView insertRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]; } } // 插入一组 - (void)InsertSection { [self.feedEntitySections insertObject:@[self.randomEntity].mutableCopy atIndex:0]; [self.tableView insertSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationAutomatic]; } // 删除一组 - (void)deleteSection { if (self.feedEntitySections.count>0) { [self.feedEntitySections removeObjectAtIndex:0]; [self.tableView deleteSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationAutomatic]; } } // 删除指定行 - (void)deleteRowWithIndexPath:(NSIndexPath *)indexPath { if (!indexPath) return; NSArray *feeds = self.feedEntitySections[indexPath.section]; if (feeds.count > 1) { [self.feedEntitySections[indexPath.section] removeObjectAtIndex:indexPath.row]; [self.tableView deleteRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:indexPath.row inSection:indexPath.section]] withRowAnimation:UITableViewRowAnimationAutomatic]; } else { [self.feedEntitySections removeObject:self.feedEntitySections[indexPath.section]]; [self.tableView deleteSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationAutomatic]; } } // 置顶 - (void)moveWithIndexPath:(NSIndexPath *)indexPath { if (!indexPath) return; NSArray *sections = self.feedEntitySections[indexPath.section]; if (sections.count > 1) { [self.feedEntitySections[0] insertObject:sections[indexPath.row] atIndex:0]; [self.feedEntitySections[indexPath.section] removeObjectAtIndex:indexPath.row + 1]; [self.tableView reloadData]; } else { [self.feedEntitySections[0] insertObject:sections[indexPath.row] atIndex:0]; [self.feedEntitySections removeObjectAtIndex:indexPath.section + 1]; [self.tableView reloadData]; } }


这里还有:


还可以点击去查询:
[UITableView]    [插入]    [定制]    [置顶]    [功能]    [UITableView插入删定制除置顶功能实现]   

请扫码加微信 微信号:sj52abcd


下载地址: http://www.taolw.com/down/7311.docx
  • 上一篇:悬浮按钮/图片/gif图/轮播图/音频/视频/自定义view
  • 下一篇:iOS10.3后允许Ap毕业设计p运行中变更App图标