My NSSavePanel is behaving strangely. Whenever I click on it (any area that normally allows you to drag the window around), it moves down the screen a few pixels. This only happens when I click on empty space like the large empty area of the toolbar.
Here is the relevant code:
@IBAction func saveThisImageAction(sender: AnyObject) {
dispatch_async(dispatch_get_main_queue()) {
let savePanel = NSSavePanel()
savePanel.nameFieldStringValue = self.thisPost.id + ".png"
let result = savePanel.runModal()
if result == NSFileHandlingPanelOKButton {
let exportedFileURL = savePanel.URL!
guard let lastImagePath = self.persistentStorage.stringForKey("lastImagePath")
else { NSLog("Error getting last post ID from persistent storage."); return }
let imageData = NSData(contentsOfFile: lastImagePath)!
imageData.writeToURL(exportedFileURL, atomically: true)
}
}
}
Why is this happening, and how can I fix it? For bonus points, the NSSavePanel doesn't become the active window when it appears. If anyone know how to fix that as well, it would be appreciated.