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: Delegate example



The category name comes after the class name. You would do it like this:
@interface NSObject (CCartTableDelegate)


On Apr 8, 2008, at 10:08 PM, Eric Gorr wrote:
I have a subclass of NSTableView called CardTable and a subclass of NSDocument called MyDocument. 

I would like CardTable to have a delegate function called rowHighlightColor which accepts the row index as a parameter and returns a NSColor.

I would like to make MyDocument the delegate of CardTable and have it implement rowHighlightColor.
Now, I via Interface Builder, I have already made MyDocument a delegate of CardTable and I know this works because MyDocument implements objectValueForTableColumn and it is getting called and is working.

This should be straightforward, but I am having trouble getting my custom rowHighlightColor delegate function setup. I was able to find an example at


which I hoped was a complete example, but it does not appear to be. 

What I did, based on this example was:

@interface CardTable : NSTableView {
}
@end

@interface CCardTableDelegate (NSObject) 
-(NSColor*)cardTable:(CardTable*)cardTable rowHighlightColor:(int)row;
@end


But, I am getting the error:

error: cannot find interface declaration for 'CCardTableDelegate'

which makes sense, but I am uncertain what to do about it.

Any thoughts or comments would be appreciated. A pointer to a complete example would be greatly appreciated.

Thank you.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/objc-language/email@hidden

This email sent to email@hidden

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/objc-language/email@hidden

This email sent to email@hidden

References: 
 >Delegate example (From: Eric Gorr <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.