Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSView subclass



You should really name your category. Something like:

@interface NSObject (MyViewDelegate)

Even better if you're targeting Leopard only is to use a formal protocol, but with optional methods. e.g.

@protocol MyViewDelegate
@optional
- (void)pointClicked:(NSPoint)point;
@end

On 15 Oct 2008, at 22:15, 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 (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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >NSView subclass (From: DKJ <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.