Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. - (void)tableView:(UITableView *)tableView didUpdateFocusInContext:(UITableViewFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator
  2. {
  3. //this gives you the indexpath of the focused cell
  4. NSIndexPath *nextIndexPath = [context nextFocusedIndexPath];
  5. }
  6.  
  7. NSIndexPath *nextIndexPath = [context nextFocusedIndexPath];
  8. NSIndexPath *prevIndexPath = [context previouslyFocusedIndexPath];
  9.  
  10. UITableViewCell *nextCell = [self.tableView cellForRowAtIndexPath:nextIndexPath];
  11. UILabel *nextTitleLabel = (UILabel *)[nextCell viewWithTag:100];
  12. nextTitleLabel.textColor = [UIColor blackColor];
  13.  
  14. UITableViewCell *prevCell = [self.tableView cellForRowAtIndexPath:prevIndexPath];
  15. UILabel *prevTitleLabel = (UILabel *)[prevCell viewWithTag:100];
  16. prevTitleLabel.textColor = [UIColor whiteColor];
  17.  
  18. override func didUpdateFocus(in context: UIFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator) {
  19. let cell = context.nextFocusedView as! UITableViewCell
  20. let indexPath = table.indexPath(for: cell)
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement