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 protected])
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]