Re: Loading Nibs which are self-ref
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 08:03:19 -0400
Yes, that was a typo. My email was acting weird.
So, I'm not entirely certain Wim. I kinda feel I'm caught between the xCode
3 way of doing things and xCode 4 (and all the variants in between). Seems
Obj-C/Cocoa is changing so fast I'm just not sure which way is right.
Specifically, when using Andrew Stones method, I would expect I could access
the UI elements of the window...uhm...somehow. That I could call the object
I attached to the nib and hide the window. Or get the string value of a
NSText field. So far, I'm stumped.
There was an xCode example which I think would clear things up for me but
this no longer exists. Possibly for good reason.
/Developer/Examples/InterfaceBuilder/SimpleMultiWindow
Anyway, I'd be happy to raw nib load as I was leaning towards or
even NSWindowController...I just want to remove my working code from my
AppController (or whatever it's called in later xCodes) and place it where
it makes more sense. So it will have a semblance of reusability rather than
entwined into 'main'.
Thanks for the responses guys. Maybe google will be kinder to me as I dive
back into it. If ya'll have any places you'd like to point me, I'll happily
check it out.
On Wed, Jul 6, 2011 at 9:11 PM, Wim Lewis <email@hidden> wrote:
>
> On 6 Jul 2011, at 2:43 PM, Kevin Muldoon wrote:
> > I'm seeking to do a copyObject class that has it's own progress window.
> So, I'm doing my research and I see a technique for loading a nib with an
> object, like so...
> >
> > MyDocument *myDocument = [[MyDocument alloc] init];
> > [NSBundle loadNibNamed:@"MyDocument" owner:myDocument];
> > [owner:myDocument doAnInterestingMethodToTheWindow];
> > Now, this looks like it's the compartmentalization I want when building
> UI!
> >
> > Andrew Stone takes things even father.
> http://www.stone.com/The_Cocoa_Files/Doing_Objects_Right.html
> >
> > So, I've been banging away at this for 10+ hours and things aren't
> working quite as expected. Given all the changes in xCode/Cocoa in the last
> 2 years, I'm wondering if I'm looking at antiquated techniques and need to
> be looking elsewhere for handling multiple windows.
>
> That looks right to me (assuming the third line's owner: is a typo). Though
> as Jens Alfke says, if you make your owner object a subclass of
> NS{View,Window}Controller it will take care of some housekeeping for you.
>
> In what way is it not working as expected? Are you checking the results of
> loadNibNamed:, etc? Are your owner object's outlets being set to the correct
> non-nil objects instantiated from the nib?
>
>
>
_______________________________________________
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