Something wrong in my NSTableView?

Discussion in 'Mac Programming' started by Simplicated, Jan 10, 2009.

  1. Simplicated macrumors 65816

    Simplicated

    Joined:
    Sep 20, 2008
    Location:
    Waterloo, Ontario, Canada
    #1
    Hi, for some reason it seems my NSTableView is not really working. It crashes the app and gives the following messages in Console
    Code:
    2009-01-10 17:26:05.017 MyApp[28858:10b] *** -[NSCFArray rowIndex]: unrecognized selector sent to instance 0x10803b0
    2009-01-10 17:26:05.018 MyApp[28858:10b] *** -[NSCFArray rowIndex]: unrecognized selector sent to instance 0x10803b0
    2009-01-10 17:26:06.856 MyApp[28858:10b] *** -[NSCFArray rowIndex]: unrecognized selector sent to instance 0x10803b0
    2009-01-10 17:26:06.859 MyApp[28858:10b] *** -[NSCFArray rowIndex]: unrecognized selector sent to instance 0x10803b0
    Part of the code:
    Code:
    -(int)numberOfRowsInTableView:(NSTableView *)aTable {
    	return [candidates count];
    }
    
    -(id)tableView:(NSTableView *)aTableView
    objectValueForTableColumn:(NSTableColumn *)tableColumn
    row:(int)rowIndex; {
    	return [candidates rowIndex];
    }
    
    Where candidates is a "global" NSArray.

    Please help me. Thank you.
     
  2. Me1000 macrumors 68000

    Me1000

    Joined:
    Jul 15, 2006
    #2
    try this rewriting the method similar to this.
    Code:
    - (id)tableView:(NSTableView *)tv 
    objectValueForTableColumn:(NSTableColumn *)tableColumn 
    			row:(int)row 
    { 
        NSString *v = [candidate objectAtIndex:row]; 
        return v; 
    }
     

Share This Page