OSX storyboard window instantiation -- Xcode 6.3.2
OSX storyboard window instantiation -- Xcode 6.3.2
- Subject: OSX storyboard window instantiation -- Xcode 6.3.2
- From: Marco S Hyman <email@hidden>
- Date: Thu, 28 May 2015 17:29:43 -0700
Hello,
I’m playing with storyboards on OSX in a project that does nothing. One of the
things I’m trying to do is open a second window from a second storyboard.
I’ve a class function in a sub-subclass of NSWindowController named
OtherWindowController that does this:
class func loadStoryboard(id: String) -> OtherWindowController? {
var otherWindowController: OtherWindowController?
if let storyboard = NSStoryboard(name: id, bundle: nil) {
otherWindowController = storyboard.instantiateControllerWithIdentifier("initial") as? OtherWindowController
}
return otherWindowController
}
It is called from this bit of code in the AppDelegate
@IBAction func showOtherWindow(sender: AnyObject) {
let otherWindowController =
OtherWindowController.loadStoryboard(“Other")
otherWindowController?.showWindow(sender)
}
The window controller in the “Other” storyboard has a custom class of
“OtherWindowController" and a Storyboard ID of “initial”
When the code runs I get this error on the console:
Storyboard (<NSStoryboard: 0x610000004a60>) doesn't contain a controller with identifier ‘initial’
I also tried “instantiateInitialController”. No errors written to the console
but the returned value is nil.
What am I doing wrong?
Marc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden