当我使用Apple Remote导航并向上或向下选择该行时(当我按Enter时不行),当我关注该行时,我正在搜索UITableView的回调函数。

在iOS上,当用户选择该行时会调用didSelectRowAtIndexPath thats,但是当用户在UITableView中导航时,找不到该函数。

最佳答案

您必须实现此委托(delegate)方法:

- (void)tableView:(UITableView *)tableView didUpdateFocusInContext:(UITableViewFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator
{
     //this gives you the indexpath of the focused cell
     NSIndexPath *nextIndexPath = [context nextFocusedIndexPath];
}

然后您就可以在该函数中使用它来做任何您想做的事

09-30 14:42
查看更多