[备忘录]tableview插入cell的正确写法
2017-12-09 16:00
295 查看
// dataToAdd 要加入的数据源
-(void)insertDownloadedActions:(NSMutableArray *)dataToAdd { int64_t delayInSeconds = 0.1; dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC); dispatch_after(popTime, dispatch_get_main_queue(), ^(void) { NSMutableArray *indexPaths = [NSMutableArray array]; NSInteger currentCount = self.array_list.count; NSInteger section; for (int i = 0; i < dataToAdd.count; i++) { if (self.index == 2) { section = 1; }else{ section = 0; } [indexPaths addObject:[NSIndexPath indexPathForRow:currentCount+i inSection:section]]; }
//原来的数据源
[self.array_list addObjectsFromArray:[dataToAdd copy]]; [self.tableView beginUpdates]; [self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone]; [self.tableView endUpdates]; }); }
相关文章推荐
- tableview插入cell
- 当tableview中每个cell对应个controller。简洁的写法如:
- Swift3.0 自定义tableView复用cell 的写法,与CollectionViewCell的不同,数据model
- UITableView cell自定义视图中插入Table实现复杂界面
- tableView中cell的删除、插入、移动、复制粘贴问题详解代码分析
- iOS tableView 在最后插入Cell
- 动态删除或者插入xib中静态TableView的Cell
- UITableView cell自定义视图中插入Table实现复杂界面
- 给tableView 的cell赋值的几种写法
- tableView cell 的刷新 插入
- iOS之tableView中的静态cell(静态单元格)
- TableView里面的cell根据图片或者文字自定义高度
- Swift iOS tableView static cell动态计算高度
- IOS中TableView的cell显示问题
- 在tableView中监听cell上textField的点击和键盘通知
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath不执行的问题
- 给tableView 截个图 只要cell的截图
- TableView的cell上面加button,实现点击button可以获取到cell的行号或者indexPath
- ios-给tableview Cell 添加不同的控件
- 关于tableview 的cell 高度不一样的做法