mac 窗口置顶的方法

窗口置顶的方法

[NSApp activateIgnoringOtherApps:YES];

窗口一直置顶的方法

[[preferenceWindowController window] setLevel: kCGStatusWindowLevel];  

 

Discussion
If flag is NO, the application is activated only if no other application is currently active. If flag is YES, the application activates regardless.
The flag is normally set to NO. When the Finder launches an application, using a value of NO for flag allows the application to become active if the user waits for it to launch, but the application remains unobtrusive if the user activates another application. Regardless of the setting of flag, there may be a time lag before the application activates—you should not assume the application will be active immediately after sending this message.
You rarely need to invoke this method. Under most circumstances, the Application Kit takes care of proper activation. However, you might find this method useful if you implement your own methods for interapplication communication.
You don’t need to send this message to make one of the application’s NSWindows key. When you send a makeKeyWindow message to an NSWindow object, you ensure that it is the key window when the application is active.

posted on 2013-03-24 15:12  陌上有缘  阅读(4847)  评论(0编辑  收藏  举报