【问题标题】:Defining the order that [tab] key presses follow in Swift在 Swift 中定义 [tab] 键按下的顺序
【发布时间】:2016-05-16 13:24:35
【问题描述】:

我有以下应用程序布局:

|    Text Field A    | |  Button A  |
|    Text Field B    | |  Button B  |

在大多数应用程序中,tab 功能允许从一个元素跳转到另一个元素以逻辑顺序(即Text Field A - Button A - Text Field B - Button B 等)工作。

当我尝试在 Interface Builder 中实现类似的东西时,似乎完全相反:不是按照上面定义的逻辑顺序,而是按照Text Field A - Text Field B - Button A - Button B 的顺序,感觉不合逻辑或不自然。

我查看了nextResponder(),但没有任何用处。

问题:

  • 如何自动确定序列?
  • 是否可以修改这个自动确定的序列?

【问题讨论】:

标签: swift macos cocoa layout swift2


【解决方案1】:

我发现将元素组放在单独的视图中有助于控制元素获得焦点的顺序。

我在模拟器和 iPad 上都试过了,对我来说效果很好。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-10-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多