【问题标题】:TvOS focus engine skip cellTvOS 焦点引擎跳过单元
【发布时间】:2018-12-19 17:09:13
【问题描述】:

我有 UITableView,其中 1 个单元格有 userInteractionEnabled = false,所以无法集中注意力。当用户尝试关注此单元格时,我想关注表格下方的按钮。如何实现呢?我尝试了didUpdateFocus 和其他方法,但没有调用它们。

【问题讨论】:

  • 提供更多上下文以便更好地澄清。

标签: swift uitableview tvos focus-engine


【解决方案1】:

【讨论】:

  • 我想这不是我的意思。我的问题是,当用户想要将单元格聚焦在 indexPath 0 时,我想将焦点更改为 tableView 下方的按钮
  • didUpdateFocus 上,您可以检查下一个单元格是否是IndexPath.row == 0 处的单元格。然后您可以在ViewController 上使用preferredFocusedView。检查这个答案:stackoverflow.com/a/33111609/8869493
  • preferredFocusedView 自 tvOS 10 起已弃用
  • 是的,现在我们有 preferredFocusEnvironments: developer.apple.com/documentation/uikit/uifocusenvironment/…
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-10-13
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多