Re: How to notify of an error...
Re: How to notify of an error...
- Subject: Re: How to notify of an error...
- From: "I. Savant" <email@hidden>
- Date: Tue, 6 Nov 2007 10:43:41 -0500
> I thought about just passing the window controller to the initWith
> section but to me that just seems like a waste of memory...
Premature optimization. A single pointer to an interesting object on
a desktop computer really is nothing at all to worry about
memory-wise. After all, you're not making a copy of your window
controller, just referencing it ...
> In .NET I would use events, but I am not sure in Cocoa?
In Cocoa you could use NSNotification ... however depending on your
requirements it might be simpler for the controller to call the
object's "open and parse the file" method, which would pass back the
overall status of the command, displaying an error if the status isn't
"a-okay".
Many mechanisms within Cocoa itself already use this pattern
(they're handed an NSError** which is specified if there's a problem,
then the caller checks this error and displays it to the user if it's
set).
--
I.S.
_______________________________________________
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