Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以防止 Cocoa 中的窗口被激活/聚焦?我正在研究 Qt,但需要实现他们的自定义 macEvent 函数,给我一个 EventRef 结构。有没有办法使用它来防止窗口在某些情况下变为活动状态?
谢谢!亚历克斯
在可可中,您可以覆盖 NSWindow 方法- (BOOL)canBecomeKeyWindow
- (BOOL)canBecomeKeyWindow
每次窗口应该成为键时都会调用它。
- (BOOL)canBecomeKeyWindow { return NO; }