0

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!

TDM
  • 814
  • 2
  • 12
  • 21

1 Answers1

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
  • 1
    That'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