1

I was having trouble with an NSSavePanel in my project, so to try to isolate the problem, I created a test project that included only the NSSavePanel code in the default window's viewDidLoad.

Test Project

The code I used to show the NSSavePanel:

dispatch_async(dispatch_get_main_queue()) {
    let savePanel = NSSavePanel()
    savePanel.nameFieldStringValue = "test.png"

    let result = savePanel.runModal()

    if result == NSFileHandlingPanelOKButton {
        print("You hit that OK button.")
    }
}

The save panel that appears looks like this:

enter image description here

The Real Project

When I use the same code (except the image file name) in my existing application, I get an NSSavePanel that appears like this:

enter image description here

Key differences:

  • The window that appears doesn't become active
  • The title bar isn't separate from the rest of the window
  • Whenever you click on something that isn't a button or a text field, the window jumps down the screen a few pixels, as though I intended to drag it around.

What in the world is happening here? Clearly the problem is bigger than just that snippet of code. Does anyone have any idea what it is?

yesthisisjoe
  • 1,987
  • 2
  • 16
  • 32

0 Answers0