是否可以设置UITableViewCell附件更改的动画

是否可以设置UITableViewCell附件更改的动画,uitableview,uiviewanimation,Uitableview,Uiviewanimation,非常简单的情况是,多行并且一次只有一行应该有复选标记。用户选择X行,X行获得复选标记,复选标记从以前选择的行中删除。但是,如何使变化生动起来呢?(淡入淡出) 我想也许这会奏效: [UIView animateWithDuration:1.0 animations:^{ cell.accessoryType = UITableViewCellAccessoryNone; cell.accessoryType = UITableViewCellAccessoryCheckmark;

非常简单的情况是,多行并且一次只有一行应该有复选标记。用户选择X行,X行获得复选标记,复选标记从以前选择的行中删除。但是,如何使变化生动起来呢?(淡入淡出)

我想也许这会奏效:

[UIView animateWithDuration:1.0 animations:^{

    cell.accessoryType = UITableViewCellAccessoryNone;
    cell.accessoryType = UITableViewCellAccessoryCheckmark;

    previous.accessoryType = UITableViewCellAccessoryCheckmark;        
    previous.accessoryType = UITableViewCellAccessoryNone;        

}];
而且

[tableView reloadRowsAtIndexPaths:paths withRowAnimation:UITableViewRowAnimationFade];
第一个没有执行任何操作,第二个删除了路径数组中NSIndexPath引用的两个单元格。我还尝试在[tableView BeginUpdate/EndUpdate]中包装重新加载的RowsatindExpath

更新:

对传入的indexPath(下面是一个简单的实现)调用reloadRowsAtIndexPath也会做同样的事情,行“变为空白”

该表是一个静态表,我为每个单元格声明并合成了属性,
cellforrowatinexpath
为每一行返回相应的单元格

.h
@property (strong, nonatomic) IBOutlet UITableViewCell *cellNever;
@property (strong, nonatomic) IBOutlet UITableViewCell *cell030;
@property (strong, nonatomic) IBOutlet UITableViewCell *cell100;

.m
@synthesize cellNever;
@synthesize cell030;
@synthesize cell100;
...
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return [cells objectAtIndex:indexPath.row];
}

- (void) viewDidLoad {
    cells = [NSArray arrayWithObjects:cellNever, cell030, cell100, cell130, cell200, cell230, cell300, cell400, cell500, nil];
}

非常感谢。

我总是
重新加载rowsatindexpaths…
它对我来说很好,不知道为什么它会删除你的。您是否在加载表格和处理附件之间的任何时间更改数据,即删除任何数据对象?(非常感谢Carl,您已经回答了我的几个问题!)。请更新以上内容。
.h
@property (strong, nonatomic) IBOutlet UITableViewCell *cellNever;
@property (strong, nonatomic) IBOutlet UITableViewCell *cell030;
@property (strong, nonatomic) IBOutlet UITableViewCell *cell100;

.m
@synthesize cellNever;
@synthesize cell030;
@synthesize cell100;
...
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return [cells objectAtIndex:indexPath.row];
}

- (void) viewDidLoad {
    cells = [NSArray arrayWithObjects:cellNever, cell030, cell100, cell130, cell200, cell230, cell300, cell400, cell500, nil];
}