Objective c 取消行索引路径对分组的UITableView没有影响

Objective c 取消行索引路径对分组的UITableView没有影响,objective-c,cocoa-touch,uitableview,Objective C,Cocoa Touch,Uitableview,分组的UITableView似乎不会以与普通UITableView相同的方式自动设置取消选择行的动画,例如,当推送并随后弹出局部视图控制器后,UITableViewController再次出现时。然而,iPhone设置应用程序似乎实现了这种行为 我已尝试在我的分组UITableViewController类的ViewWillAspect方法中实现该行为,但它根本没有效果: - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear

分组的UITableView似乎不会以与普通UITableView相同的方式自动设置取消选择行的动画,例如,当推送并随后弹出局部视图控制器后,UITableViewController再次出现时。然而,iPhone设置应用程序似乎实现了这种行为

我已尝试在我的分组UITableViewController类的ViewWillAspect方法中实现该行为,但它根本没有效果:

- (void)viewWillAppear:(BOOL)animated {

[super viewWillAppear:animated];

//If returning from an edit then animate the deselection of the previously selected row
if ([self currentIndexPath] != nil) 
{
    [[self tableView] deselectRowAtIndexPath:[self currentIndexPath] animated:YES];
    [self setCurrentIndexPath:nil];
}
...
根据我的UITableView,
[self-currentIndexPath]
的行和节属性始终正确有效,但行取消选择仍然不会设置动画。我还尝试使用以下命令取消选择行,但同样没有成功:

[[self tableView] deselectRowAtIndexPath:[[self tableView] indexPathForSelectedRow] animated:YES];

请有人帮忙解释一下这种行为是如何实现的吗?

您的建议正确吗

我完全没有问题。是否将TableView与self.TableView连接(如果使用插座连接)

最好的,
Christian

Hi Christian,我的类继承自UITableViewController,因此我使用它的tableView。索引路径绝对正确,节和行始终与所选的表节和行相关。我注意到,很多第三方应用程序也没有这样做,但苹果的应用程序确实如此。你在分组UITableView上使用过这个吗?太好了,谢谢。我的实现没有使用.xib,所以我只能假设Interface Builder正在生成一些东西来实现它,而在以编程方式设置表视图时,我缺少一个细节。