A TVOS
UITableViewDelegate
new method has appeared tableView:didUpdateFocusInContext:withAnimationCoordinator:
that will be called when the focus changes, you can get the previous IndexPath and nextFocusIndexPath, and then you can use the tableView methods to get the cells, your code should look like this:
- (void)tableView:(UITableView *)tableView didUpdateFocusInContext:(UITableViewFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator
{
NSIndexPath *prevIndexPath = [context previouslyFocusedIndexPath];
if (prevIndexPath)
{
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:prevIndexPath];
cell.textLabel.textColor = [UIColor white];
}
NSIndexPath *nextIndexPath = [context nextFocusedIndexPath];
if (nextIndexPath)
{
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:nextIndexPath];
cell.textLabel.textColor = [UIColor blackColor];
}
}
See Apple docs for more details .
source
share