
[self.tableVIEw reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:anim];
当用户滑动以删除行时,它可以正常工作.然而,当用户通过分段控件切换数据集时,DELETED CELL会在不改变其外观的情况下被重复使用(即红色的“DELETE”按钮仍然存在且行内容无处可见).这似乎是大多数人看到的相反问题,即删除按钮没有出现.
这是删除代码:
- (UItableVIEwCellEditingStyle) tableVIEw:(UItableVIEw *)tableVIEw editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{ return UItableVIEwCellEditingStyleDelete;}- (voID) tableVIEw:(UItableVIEw *)tableVIEw commitEditingStyle:(UItableVIEwCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{ if (editingStyle == UItableVIEwCellEditingStyleDelete) { if ([self.current isEqualTo:self.favorites]) { Favorite *fav = self.favorites[indexPath.row]; NSMutableArray *mut = [self.favorites mutablecopy]; [mut removeObjectAtIndex:indexPath.row]; self.favorites = mut; self.current = self.favorites; [self.tableVIEw deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UItableVIEwRowAnimationautomatic]; } }} tablevIEw设置为single select,self.tableVIEw.editing == NO.我也尝试使用[self.tableVIEw reloadData]并删除/插入从一个数据集到下一个数据集的行差异.两者都不起作用.
我正在使用的UItableVIEwCell不提供backgroundVIEw或selectedBackgroundVIEw
[编辑]
分段控制值已更改:
- (IBAction)modeChanged:(ID)sender{ if (self.ListMode.selectedSegmentIndex == 1) { self.current = self.favorites; } else { self.current = self.recents; } // Tryin this: [self.tableVIEw reloadData]; // TrIEd this: // [self.tableVIEw reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UItableVIEwRowAnimationFade];}// Only 1 Section per table- (NSInteger)tableVIEw:(UItableVIEw *)tableVIEw numberOfRowsInSection:(NSInteger)section;{ return [self.current count];}解决方法 哦,因为…的爱 我没有打电话给[super prepareForReuse];在我的UItableVIEwCell子类中.
啊.
总结以上是内存溢出为你收集整理的ios – UITableViewCell删除按钮不会消失全部内容,希望文章能够帮你解决ios – UITableViewCell删除按钮不会消失所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)