iOS or Mac OS?

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

>  Okay, I've got my custom NSView subclass to draw my Shape objects (or 
> subclasses thereof). Each Shape inherits or overrides:
> 
> -(BOOL)shapeContainsPoint:(CGPoint)thePoint;
> 
>  Now, I want to detect clicks within the view and iterate over all the 
> objects the view is responsible for, and send them the above message. My 
> Document.h declares:
> 
> -(IBAction)didClick:(id)sender;
> 
> which - for now - just does an NSLog(). 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).
>  Furthermore, what's the recommended way to communicate the X,Y position 
> (CGPoint) where the user clicked in the drawable area of the view -> delegate 
> that has the action triggered when the user clicks (i.e. see above)? Should 
> the view hold on to the X,Y location, then provide these are readonly 
> properties which the action code in the delegate can fetch through the 
> (id)sender? Or is there a better way?
> 
> 
> 
> _______________________________________________
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com

_______________________________________________

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