• 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: Loading Nibs which are self-ref
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Loading Nibs which are self-ref


  • Subject: Re: Loading Nibs which are self-ref
  • From: Kevin Muldoon <email@hidden>
  • Date: Thu, 07 Jul 2011 18:50:47 -0400

Ahh. Yes. I see what you're saying. And maybe you see where I was confused. This GUI approach to hooking up code/UI is nifty, but extremely difficult to explain/comprehend.

As to xCode2,xCode3,xCode4, you'll notice one of the first things we used to have  to do was create an AppController, then create an NSObject in IB and then make it a subclass of AppController and then hook it as a delegate of File Owner. That was annoying, and in later additions of xCode, the AppDelegate is automagically created and xCode encouraged developers  to access UI elements via separate Controller objects.

This makes sense and I wanted to do just that, but  you'll notice nobody ever mentions subclassing the File's Owner of SecondWindow.nib to the SecondWindow.m the window is supposed to be controlled by.

As if to say this would be explaining how exactly to breathe.



On Jul 7, 2011, at 5:36 PM, Jens Alfke wrote:

>
> On Jul 7, 2011, at 12:45 PM, Kevin Muldoon wrote:
>
>> Can I (or should I) hook up File's Owner as I would a subclass of NSWindowController? Thereby skipping creating a new object->subclassing as SecondWindow? That seems 'right'. That nicely separates my code from my UI, making it (bit) more portable, but may be contributing to unresponsive behavior.
>
> I’m sorry, I don’t understand what you’re asking. The class of the Files’ Owner object should be set to your NSWindowController subclass. You don’t add any custom object to the nib for the window controller.
>
> The “File’s Owner” pseudo-object in the nib is a placeholder for the pre-existing object specified as the owner when the nib is loaded; it’s not an object loaded by the nib. The purpose of that object is so that outlets in that object can be hooked up, and so objects from the nib can be pointed at it.
>
>> For instance...This code will update NSTextField with text...
>>
>> 	secondWindow = [[SecondWindow alloc] init];
>> 	[secondWindow setStringValueOfMyTextField:@"Hello! I am SecondWindow! I am very glad to meet you."];
>> 	[secondWindow showWindow:secondWindow];
>>
>> This code will NOT update NSTextField with text...
>>
>> 	secondWindow = [[SecondWindow alloc] init];
>> 	[secondWindow showWindow:secondWindow];
>> 	[secondWindow setStringValueOfMyTextField:@"Hello! I am SecondWindow! I am very glad to meet you.”;
>
> Both of those should work correctly.
>
> —Jens


Kevin Muldoon
e: email@hidden

_______________________________________________

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

References: 
 >Loading Nibs which are self-ref (From: Kevin Muldoon <email@hidden>)
 >Re: Loading Nibs which are self-ref (From: Wim Lewis <email@hidden>)
 >Re: Loading Nibs which are self-ref (From: Kevin Muldoon <email@hidden>)
 >Re: Loading Nibs which are self-ref (From: Jens Alfke <email@hidden>)
 >Re: Loading Nibs which are self-ref (From: Kevin Muldoon <email@hidden>)
 >Re: Loading Nibs which are self-ref (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Loading Nibs which are self-ref
  • Next by Date: linking the same static library into two places
  • Previous by thread: Re: Loading Nibs which are self-ref
  • Next by thread: How to change font trait and font family for a NSBrowserCell
  • Index(es):
    • Date
    • Thread