• 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: how to centralize functionality more elegantly?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to centralize functionality more elegantly?


  • Subject: Re: how to centralize functionality more elegantly?
  • From: Ondra Cada <email@hidden>
  • Date: Thu, 5 Sep 2002 21:56:39 +0200

On Thursday, September 5, 2002, at 07:14 , Matt Neuburg wrote:

[(MainController*) [NSApp delegate] showStatus: @"You cannot do that."]
;

Is there a more elegant way to be doing this? m.

Definitely:

[[NSNotificationCenter defaultCenter] postNotification:@"ShowStatusNotification" object:@"You can do this"];

Also, you might consider

[NSApp sendAction:@selector(showStatus:) to:nil from:@"You cannot do that"
];

which is also kind of more flexible than your original solution (the method can be catched by a front view/window/controller if applicable, if not, it would fall through to the NSApp delegate), but is this very case it seems superfluous, and using the string argument as a sender is even a tad on the unclean side.
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >how to centralize functionality more elegantly? (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: Launching an App without NSWorkspace?
  • Next by Date: Re: Launching an App without NSWorkspace?
  • Previous by thread: Re: how to centralize functionality more elegantly?
  • Next by thread: Re: how to centralize functionality more elegantly?
  • Index(es):
    • Date
    • Thread