gpt4 book ai didi

objective-c - 删除/插入 View 后 NSResponder 链被破坏

转载 作者:行者123 更新时间:2023-12-03 17:48:54 26 4
gpt4 key购买 nike

看来,当我从 NSViewController 主视图中删除 subview 时,响应者链会被修改,并且新 View 永远不会收到第一个响应者。

View Controller 位于弹出窗口内。顶部有搜索字段,下面有自定义 View (搜索结果)。当我显示弹出窗口时,我可以使用选项卡转到自定义 View 。但是,如果我搜索某些短语,搜索结果就会更改,并且选项卡不再起作用。

知道是否有办法“修复”响应者链吗?

最佳答案

迈克·阿卜杜拉的回答

NSPopover: Key View Loop

While poking around NSPopover, one discovery has slightly surprised me: The NSWindow that AppKit creates behind the scenes for the popover has autorecalculatesKeyViewLoop turned off. That can have slightly odd consequences if you’re dynamically changing the content or layout of the popover, since AppKit won’t take those changes into account.

(If you need a quick explanation, The Key View Loop defines what happens when you hit the tab key, which control the focus moves to)

Since we don’t own the window in question, I’m a little hesitant to turn autorecalculatesKeyViewLoop on. Instead, it’s generally pretty simple to call recalculateKeyViewLoop on the window after you’ve made a change.

关于objective-c - 删除/插入 View 后 NSResponder 链被破坏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34612744/

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