If its a delegate you would want to check if the delegate handles the selector with respondsToSelector and the use performSelector to make the call. For example....

if ([delegate respondsToSelector:@selector(pointClicked:)])
[delegate performSelector:@selector(pointClicked:) withObject: [NSValue valueWithPoint:(pt)]];

This should work. I believe the NSValue will resolve to the NSPoint in runtime.

Scott Andrew


On Oct 15, 2008, at 2:15 PM, DKJ wrote:

I've written a subclass of NSView. It calls a method its delegate can implement to detect mouse clicks. I've put something like this in the header file:

// delegate method:
@interface NSObject ()
- (void)pointClicked:(NSPoint)point;
@end

This is enough to prevent a "no -pointClicked: method found" compiler warning. But is it the best way to do it?

dkj
_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/scottandrew%40roadrunner.com

This email sent to [EMAIL PROTECTED]

_______________________________________________

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

This email sent to [EMAIL PROTECTED]

Reply via email to