On Wed, Jun 18, 2008 at 1:04 PM, David Carlisle
<[EMAIL PROTECTED]> wrote:
> I have a navigator object which maintains a stack of NSViewControllers.
>  When I create a new NSViewController and push it to the navigator, I want
> the view's back button to show the name of the previous view.  If the
> navigator tries to set the title of the button, the button is still null
> because it has not yet awoke from the nib.

By the time -awakeFromNib is called, all outlets will point to valid
objects.  It sounds like you're doing something too early.

> The navigator can pass the
> previous view to the new view so that when the new view does an
> awakeFromNib, it can get the title of the previous view and set its back
> button accordingly.

This also sounds like bad design.  Perhaps you want to abstract things
a bit further?  I don't know exactly what you're doing, but why do you
have a button that does the same thing on each of your subviews,
rather than one button outside the subviews that sends a -goBack:
action or something of that sort?

> This works, but I'm concerned that if awakeFromNib is
> being done in a separate thread then I have a race condition between
> awakeFromNib and the navigator setting the previous view.  Though it works
> now, might it break with a multicore computer?

AppKit is not thread safe, and everything* is done on the main thread.

--Kyle Sluder

* For some value of "everything".
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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]

Reply via email to