本文介绍了让NSWindow前面但不在焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在所有其他窗口前面带来一个新的NSWindow,但是没有它的焦点。



我可以使它出现在前面与焦点具有以下内容:

 
NSApplication * thisApp = [NSApplication sharedApplication];
[thisApp activateIgnoringOtherApps:YES];

[self makeKeyAndOrderFront:self];

任何有关如何使其显示在顶部但不能将焦点从另一个应用程序移开的线索?

c> c> c> >()


I'm looking to bring a new NSWindow in front of all other windows, but not have it take focus.

I can make it appear in front with focus with the following:

NSApplication *thisApp = [NSApplication sharedApplication];
[thisApp activateIgnoringOtherApps:YES];

[self makeKeyAndOrderFront:self];

Any clues on how to make it appear on top but not take focus away from another application?

解决方案

Instead of makeKeyAndOrderFront:, try just orderFront: (docs)

这篇关于让NSWindow前面但不在焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 23:48