1

I have UITableView where 1 cell has userInteractionEnabled = false so can't be focused. When user try to focus this cell I want to focus button under the table. How to achieve it ? I tried didUpdateFocusand other methods but they are not called.

hds
  • 33
  • 1
  • 8

1 Answers1

0

Use canBecomeFocused on that 1 cell: https://developer.apple.com/documentation/uikit/uiview/1622584-canbecomefocused

Gustavo Vollbrecht
  • 3,188
  • 2
  • 19
  • 37
  • I guess it is not what i meant. My problem is that when User want to focus cell at indexPath 0 then I want to change focus on button below tableView – hds Dec 19 '18 at 17:32
  • on `didUpdateFocus` you can check if the next cell is the one at IndexPath.row == 0. Then you can use `preferredFocusedView` on your ViewController. Check this answer: https://stackoverflow.com/a/33111609/8869493 – Gustavo Vollbrecht Dec 19 '18 at 17:43
  • preferredFocusedView is deprecated since tvOS 10 – hds Dec 19 '18 at 17:47
  • yes, now we have `preferredFocusEnvironments`: https://developer.apple.com/documentation/uikit/uifocusenvironment/1648972-preferredfocusenvironments – Gustavo Vollbrecht Dec 19 '18 at 17:54