I would like to know if there is a way to make one of my NSViewControllers stay on top of the rest of them in Xcode or Swift 2. I am also working with OS X Cocoa. Thanks!
Asked
Active
Viewed 302 times
0
-
2Can you give more context for this question? What is the situation. And by NSViewController does that mean you are working with OS X? – Rob Norback Jan 21 '16 at 02:16
-
1You mean your window – Leo Dabus Jan 21 '16 at 02:26
-
Ok I updated my post. Thanks for your clarification. – TDM Jan 21 '16 at 04:21
1 Answers
0
I assume you have NSViewControllers in multiple windows, and it's one of the windows that you want to keep on top of the others. This is done by setting the window.level
:
window.level = Int(CGWindowLevelForKey(.FloatingWindowLevelKey))

Michael
- 8,891
- 3
- 29
- 42
-
I'm getting an error that says, "Value of type 'NSView' has no member 'level'. You are exactly right in what you assumed about my question. You are right! – TDM Jan 22 '16 at 00:36
-
1That's because you have a NSView, whereas you need a NSWindow. If your NSView is in a variable called `view`, then you can get to the window with `view.window`, so therefore you can set the level with `view.window.level = ...`. – Michael Jan 22 '16 at 00:39