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

Re: Custom NSViews


  • Subject: Re: Custom NSViews
  • From: Alex Zavatone <email@hidden>
  • Date: Fri, 06 Jul 2012 20:13:48 -0400

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 (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

_______________________________________________

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

  • Follow-Ups:
    • Re: Custom NSViews
      • From: William Squires <email@hidden>
References: 
 >Custom NSViews (From: William Squires <email@hidden>)

  • Prev by Date: Re: Is this an incorrect use of categories ?
  • Next by Date: Re: Is this an incorrect use of categories ?
  • Previous by thread: Custom NSViews
  • Next by thread: Re: Custom NSViews
  • Index(es):
    • Date
    • Thread