On Jul 6, 2012, at 4:55 PM, William Squires wrote:

> How do I get my ShapeView class (the custom NSView subclass) to have the 
> necessary code/declarations so that IB can see that it can originate an 
> action, just like an NSButton or other control (i.e. Ctrl-drag from the 
> control to the action in the delegate).

I think it would have to subclass NSControl; then IB would let you wire up its 
target/action properties. This is a bit of a dead-end, though, as it only lets 
you communicate one thing, i.e. a click on a shape. You're probably going to 
want something richer.

Another way to do it is to create a 'delegate' or 'target' IBOutlet on your 
view class that you wire up to the object that will be called when events 
happen. If you want to be formal about it you can define a protocol in your 
view's header, and then have the document implement it. This way you can extend 
that protocol to add methods that will be called in other circumstances.

—Jens
_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to