i trying to make a osx application that just have one window and it will always on the top of screen. anyone knows how to achieve it? thanks.
Asked
Active
Viewed 4,497 times
14
-
Before you do this, consider very carefully whether it really is the Right Thing. You should at least make it a feature that the user switches on and off. – JeremyP Jul 19 '10 at 07:35
2 Answers
25
You can change the window's windowLevel (via -setLevel:) to NSFloatingWindowLevel.
[window setLevel:NSFloatingWindowLevel];
Documentation is here: Window_Levels

sqweek
- 1,129
- 9
- 12

Alan Rogers
- 15,018
- 3
- 28
- 19
1
By "on the top", do you mean you do not want your window to be obscured, even if a different app is active? In that case, one way is to start with the NSPanel template in Interface Builder, check the "Utility" option, and uncheck "Hide on Deactivate".

JWWalker
- 22,385
- 6
- 55
- 76