• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
OSX storyboard window instantiation -- Xcode 6.3.2
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: OSX storyboard window instantiation -- Xcode 6.3.2
      • From: Marco S Hyman <email@hidden>
  • Prev by Date: Re: How do I set a watchpoint?
  • Next by Date: Re: How do I set a watchpoint?
  • Previous by thread: Re: Putting tests in same file as code to be tested?
  • Next by thread: Re: OSX storyboard window instantiation -- Xcode 6.3.2
  • Index(es):
    • Date
    • Thread