• 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
Re: NSWindowController for Prefs XIB Question (Core Data involved)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSWindowController for Prefs XIB Question (Core Data involved)


  • Subject: Re: NSWindowController for Prefs XIB Question (Core Data involved)
  • From: Steve Cronin <email@hidden>
  • Date: Fri, 21 May 2010 01:51:55 -0500

Folks;

This one is driving me mad!
I'm trying to bust up an overly complicated xib into 2 xibs - the main xib and a preference xib

I've started completely over trying to implement a pref xib -- no CoreData just bare bones….

I have created a brand new subclass of NSWindowController: Pref2Controller
	there is not a single line of code in this object nor any instance variables.
I have created a brand new xib file: ptest
	XCode creates the xib with a FilesOwner, FirstResponder, Application, and Window (set to releaseOnClose and visibleAtLaunch)
I have set the FilesOwner to be an instance of Pref2Controller (using IB)
I have set the window outlet of the FilesOwner to point to the NSWindow object (using IB)
These two are the only changes I've made to ptest.xib
When I use this code in the appDelegate:

- (IBAction) configure:(id)sender {
	if (!prefPanelController) {
		prefPanelController = [[Pref2Controller alloc] initWithWindowNibName:@"ptest"];
	}
   [prefPanelController showWindow:sender];
}

The new ptest.xib window will open once but never again if I close it.
	this is true regardless of whether I set the window to releaseOnClose or not
	this is also true regardless of whether I have hooked up the window outlet or not
		logging [pController window] shows (null) regardless of whether I have outlet assigned or not
		as well as regardless of whether prefPanelController already exists or has just been alloc'ed and init'ed..

What I am just not understanding here?
Please?
Steve

On May 20, 2010, at 10:08 PM, Steve Cronin wrote:

> Folks;
>
> I have a feeling that this is an embarrassing one so try and go easy on me…
> XC 3.2.2
>
> I have a main nib that opens a window and that works fine.
> I used to have an NSPanel in this nib to handle preferences.
> I've decided it's a good idea to split the nib into two different nibs: the main nib and a preferences nib.
>
> I've looked over the Sketch project and used it as a model.
> I've also read over the Document-Based App Overview FAQ
>
> I've added a window nib to the project and then subclassed a NSWindowController.
> I've made the xib's files owner this window controller
> At this point I can get a simple empty window to open just fine.
>
> However, I'm using CoreData and I want to pass the existing MOC to the pref window:
> I have added an array controller to the pref nib with its MOC set to files owner's MOC in IB.
> The controller manages an entity not a mutable dictionary.
> MOC is a synthesized property of the PrefController (the windowController mentioned above).
>
> if (!prefPanelController) {
> 	prefPanelController = [[PreferencesController alloc] initWithWindowNibName:@"testPref"];
> 	[prefPanelController setManagedObjectContext:[self managedObjectContext]];
> }
> [prefPanelController showWindow:sender];
>
> No window opens and I get a console error:  Cannot perform operation without a managed object context
>
> Could someone give me the gentle head slap I need here?
> Steve


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSWindowController for Prefs XIB Question (Core Data involved)
      • From: Quincey Morris <email@hidden>
References: 
 >NSWindowController for Prefs XIB Question (Core Data involved) (From: Steve Cronin <email@hidden>)

  • Prev by Date: Re: NSWindowController for Prefs XIB Question (Core Data involved)
  • Next by Date: Re: NSWindowController for Prefs XIB Question (Core Data involved)
  • Previous by thread: Re: NSWindowController for Prefs XIB Question (Core Data involved)
  • Next by thread: Re: NSWindowController for Prefs XIB Question (Core Data involved)
  • Index(es):
    • Date
    • Thread