I am using storyboard to create a window controller with a NSToolbar. Using the toolbar buttons I'm trying to switch the contentViewController of the window to other viewControllers.
@IBAction func switchViewControllers(sender: NSToolbarItem) {
if sender.label == "one" {
self.window?.contentViewController = self.storyboard?.instantiateControllerWithIdentifier("one") as? NSViewController
}
if sender.label == "two" {
self.window?.contentViewController = self.storyboard?.instantiateControllerWithIdentifier("two") as? NSViewController
}
}
Clicking on the toolbarItems switches the ViewControllers as expected but I am noticing some graphic glitches at the edges of the window when switching thew ViewControllers.
Am I missing something?