我可以发送消息 makeKeyAndOrderFront: 来激活窗口。但是,如果我将其发送到没有标题栏的窗口,它不会激活。有什么方法可以使没有标题栏的窗口处于事件状态?
最佳答案
您需要覆盖 -canBecomeKeyWindow
在您的 NSWindow
子类中返回 YES
。
根据文档:
Attempts to make the window the key window are abandoned if this method returns NO. The NSWindow implementation returns YES if the window has a title bar or a resize bar, or NO otherwise.
关于objective-c - 如何激活没有标题栏的窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8279951/