• 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: Conceptual problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Conceptual problem


  • Subject: Re: Conceptual problem
  • From: Sherm Pendley <email@hidden>
  • Date: Thu, 9 Jan 2003 04:51:17 -0500

On Thursday, January 9, 2003, at 12:01 AM, Michael Norris wrote:

My question is: how do I send a message from a "view" class to a "controller" class (MVC)? (At least I think that's my question...)

The methods for this are inherited from NSControl. Assuming you've made the proper connections in IB, you'd do something like this:

[self sendAction: @selector(aMessage:) to: [self target]];

Why use sendAction:to: instead of directly sending the message with [[self target] aMessage: self]? Because if you connect your control to the "First Responder" in IB, [self target] will return nil. Sending a message directly to a nil object does nothing, but if sendAction:to: is given a nil target, it will search through the responder chain to look for an object that implements a method to handle the action.

sherm--

UNIX: Where /sbin/init is Job 1.
_______________________________________________
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: 
 >Conceptual problem (From: Michael Norris <email@hidden>)

  • Prev by Date: String Attributes
  • Next by Date: Getting notified when the contents of the pasteboard changes (again)
  • Previous by thread: Re: Conceptual problem
  • Next by thread: Re: Conceptual problem
  • Index(es):
    • Date
    • Thread