gpt4 book ai didi

macos - 无法在 NSPopover 中获取 Tab 键顺序

转载 作者:行者123 更新时间:2023-12-03 16:47:30 24 4
gpt4 key购买 nike

我在 NSPopover 中有一个 View ,但无法正确设置 Tab 键顺序。我已经在 4 个文本字段中设置了 nextKeyView。但它倾向于从 TextField1 翻转到 Search1,而不是 TextField1 -> TextField2。我尝试过插入 [self.view.window makeFirstResponder:textField1] 以及 [self.view.window setInitialFirstResponder:textField1] 以及 recalculatekeyviewloop 但没有运气。

任何帮助将不胜感激。

最佳答案

在 awakeFromNIB 中以编程方式编写某些 subview 的弹出 View 时,我遇到了类似的问题。我可以通过在弹出窗口设置其私有(private) NSPopoverWindow (即第一次显示)后插入 subview 来解决问题。当弹出窗口 View 嵌入到私有(private)子窗口中时,弹出窗口似乎正在重新评估 View 循环 - 忽略 View 中给出的 View 循环。

您可以尝试以下方法:

-(void) popoverDidShow:(NSNotification *)notification{  // NSPopoverDelegate-method
if (!popoverDidShowForTheFirstTime){
[self setUpViews];
}...


-(void) setUpViews{
popoverDidShowForTheFirstTime = YES;
// insert views and establish nextKeyViews ...

关于macos - 无法在 NSPopover 中获取 Tab 键顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9764369/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com