Ios 剖视图已加载到单元上
如图所示。我创建了一个tableview,它可以通过插入一行进行拆分。当我单击单元格时,插入灰色的一行,再次单击以取消拆分: 代码如下:Ios 剖视图已加载到单元上,ios,objective-c,uitableview,Ios,Objective C,Uitableview,如图所示。我创建了一个tableview,它可以通过插入一行进行拆分。当我单击单元格时,插入灰色的一行,再次单击以取消拆分: 代码如下: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { int clickCellRow = [indexPath row] + 1; int clickCellSection = [indexPath se
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
int clickCellRow = [indexPath row] + 1;
int clickCellSection = [indexPath section];
[self beginUpdates];
if (isEditFlag == NO) {
isEditFlag = YES;
[tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:clickCellRow inSection:clickCellSection]] withRowAnimation:UITableViewRowAnimationFade];
}
else {
isEditFlag = NO;
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:clickCellRow inSection:clickCellSection]] withRowAnimation:UITableViewRowAnimationFade];
}
[self endUpdates];
}
它在IOS6上运行良好,但在IOS7上出现了一个bug。单击一个单元格并插入拆分的行时,sectionView将被强制移出屏幕:
取消拆分后,向上滚动隐藏的单元格。下表所示为:
似乎剖视图已加载到单元上!这是如何发生的,如何修复