2014-03-26 59 views
0

所以我建立了一个自定义动画,使细胞熄灭屏幕的左边(类似于如何deleteRowsAtIndexPaths:与UITableViewRowAnimationLeft看起来)。我这样做是因为,如果我尝试批量删除(删除表中的所有行)采用了经典的方法(deleteRowsAtIndexPaths:与UITableViewRowAnimationLeft)看起来不正确的。现在我的自定义动画看起来很不错我有不同的菜单按钮,首先使用我的动画清除表格,效果很好。事情是我想要同样的动画来踢,当我选择一个单元格在表中,但由于某种原因,它只是不工作(没有动画踢)。这里的动画代码寿应该是多余的(此代码获取的呼吁每个cell--从最后到第一行):自定义单元格动画didSelectRowAtIndexPath方法不工作:

NSIndexPath *ip = [NSIndexPath indexPathForRow:i inSection:0]; 
UITableViewCell *cell = [_table cellForRowAtIndexPath:ip]; 
CGRect newFrame; 

if(i%2==0){ 
    newFrame = cell.frame; 
    newFrame.origin.x = -[UIScreen mainScreen].bounds.size.width; 
}else{ 
    newFrame = cell.frame; 
    newFrame.origin.x = [UIScreen mainScreen].bounds.size.width; 
} 
[UIView animateWithDuration:0.2 delay:0 options:0 
       animations:^{cell.frame = newFrame;} 
       completion: ^(BOOL finished){ 
        //[cell removeStatus]; 
        if(i == 0){ 

         [dataSource removeAllObjects]; 
         [_table reloadData]; 
        } 
}]; 

回答

0

我找到了一个解决方法这个问题。我将动画转换为基本动画,现在它可以工作。

相关问题