【问题标题】:how to use preferredFocusEnvironments insted of preferredFocusedView for ios 10?ios 10 如何使用preferredFocusEnvironments insted of preferredFocusedView?
【发布时间】:2016-11-18 04:03:34
【问题描述】:

我正在开发 Apple tv os 应用程序。我想将焦点移到特定的 UiButton 上,但我不知道如何使用 preferredFocusEnvironments 而不是 preferredFocusedView ?

我可以使用preferredFocusedView,但不推荐使用此变量。

所以有人可以帮我解决这个问题吗?

【问题讨论】:

标签: tvos apple-tv tvos9.1 tvos10


【解决方案1】:

我可以通过关注link来解决这个问题

我所做的如下:

@IBOutlet weak var viewTemp: UIView!
override var preferredFocusEnvironments : [UIFocusEnvironment] {
    //Condition
    return [viewTemp]
}

安装了这个。

override weak var preferredFocusedView: UIView? {
    //Condition
    return viewTemp
}

【讨论】:

  • 这是个好方法,每当您找到解决方案时,您都会提出您的建议
猜你喜欢
  • 2018-07-22
  • 2023-01-18
  • 1970-01-01
  • 1970-01-01
  • 2016-12-05
  • 1970-01-01
  • 2017-07-23
  • 1970-01-01
  • 2011-11-02
相关资源
最近更新 更多