Skip navigation.
 
mlRe: NSOutlineView byItem reference
FROM : Charilaos Skiadas
DATE : Mon Apr 11 07:01:12 2005

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

Related mailsAuthorDate
mlNSOutlineView byItem reference Gerald Hanks Apr 11, 06:51
mlRe: NSOutlineView byItem reference Charilaos Skiadas Apr 11, 07:01