我一直在试图区分在我的UITableView编辑状态。区分UITableView编辑状态?
我只需要时调用的方法在编辑模式下轻敲编辑按钮后,那么当你拿到你的幻灯片中,你看到的小圆形删除图标,但在用户刷卡删除。
无论如何我可以区分两者吗?
谢谢。
编辑:
解由于罗德里戈
无论每个小区和整个的tableview具有“编辑” BOOL值,所以循环通过所有的细胞,并且如果它们中的一个以上的被编辑然后我们知道整个表格(用户点击编辑按钮),但是如果只有一个正在编辑,那么我们知道用户已经刷过一个单元格,编辑单个单元格,这让我可以单独处理每个编辑状态!
- (void)setEditing:(BOOL)editing animated:(BOOL)animated
{
[super setEditing:editing animated:animated];
int i = 0;
//When editing loop through cells and hide status image so it doesn't block delete controls. Fade back in when done editing.
for (customGuestCell *cell in self.tableView.visibleCells)
{
if (cell.isEditing) {
i += 1;
}
}
if (i > 1)
{
for (customGuestCell *cell in self.tableView.visibleCells)
{
if (editing)
{
// loop through the visible cells and animate their imageViews
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.4];
cell.statusImg.alpha = 0;
[UIView commitAnimations];
}
}
}
else if (!editing)
{
for (customGuestCell *cell in self.tableView.visibleCells)
{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.4];
cell.statusImg.alpha = 1.0;
[UIView commitAnimations];
}
}
}
恕我直言,这不起作用:当在常规编辑模式(所有单元格可编辑),然后第一个单元格认为它是在“在删除模式下滑动”。 – obiwahn 2012-11-23 11:12:16