Re: NSOutlineView byItem reference
Re: NSOutlineView byItem reference
- Subject: Re: NSOutlineView byItem reference
- From: Charilaos Skiadas <email@hidden>
- Date: Mon, 11 Apr 2005 00:01:12 -0500
On Apr 10, 2005, at 11:51 PM, Gerald Hanks wrote:
I have a project in which I am using an NSOutlineView, some
CharacterSet(s) (my own class) and some Character(s) (also my own
class)
In my control object I have the delegate function:
- (void)outlineView:(NSOutlineView *)outlineView
setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn
byItem:(id)item {
...
if([item isMemberOfClass:[CharacterSet class]]) {
NSEnumerator * characterEnum;
characterEnum = [[item characters] objectEnumerator];
You need to cast the item to the class you want, so maybe this would
solve your compiler warnings:
characterEnum = [[(CharacterSet *)item characters] objectEnumerator];
...
}
...
}
When I compile this code I get the following warnings:
Controller.m:343: warning: multiple declarations for method
`characters'
/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:141:
warning: using `-(NSString *)characters'
CharacterSet.h:35: warning: also found `-(NSArray *)characters'
/System/Library/Frameworks/AppKit.framework/Headers/
NSTextStorageScripting.h:21: warning: also found `-(NSArray
*)characters'
Controller.m:343: warning: `NSString' may not respond to
`-objectEnumerator'
Everything runs the way it should since my CharacterSet class does in
fact have a method 'characters' which returns the NSArray of
characters, but I would like to know if there is a more appropriate
way to do this so that I do not receive the compiler warnings.
As you can see I am fairly new to cocoa programming and would
appreciate any and all suggestions.
--gerald _______________________________________________
HTH,
Haris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden