• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSTableView problem: selector not recognized.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTableView problem: selector not recognized.


  • Subject: NSTableView problem: selector not recognized.
  • From: "Frederick C. Lee" <email@hidden>
  • Date: Mon, 15 Nov 2004 20:33:28 -0800

Greetings:
I'm having problem implementing the 'selector' of a NSTableView. It works the first time, by the second attempt gives me the following error:


The error:
2004-11-15 20:16:32.319 ricCountries[1552] *** -[NSCFType tableView:objectValueForTableColumn:row:]: selector not recognized
2004-11-15 20:16:32.322 ricCountries[1552] *** -[NSCFType tableView:objectValueForTableColumn:row:]: selector not recognized


Simple Scenario:
1) Populating a NSTableView's single column with an array of NSString values.
2) Selecting 1 or more rows and processing accordingly.
3) The 'selector' is set in item (B) below, with the Data Source.



Modus Operandi:
I use a NSArray category {separate implementation} to bind the NSTableView with the NSArray data source (item (C) below). The 'selector' is defined in a separate (main) implementation.




@implementation MyController
...
...
// (A) This is the method called by NSTableView double-click event (B):

- (void) processCountry:(id)sender {

NSLog(@"{processCountry} Selected Rows are: %@", [[self loadCountries_TableView] selectedRowIndexes]);
}
...
...


// (B) Setting up NSTableView's data source:

 - (void)windowDidBecomeKey:(NSNotification *)aNote {

[[self loadCountries_TableView] setDataSource:loadCountriesArray]; <-- setting the NSTableView's data source.
[[self loadCountries_TableView] setTarget:self];
[[self loadCountries_TableView] setDoubleAction:@selector(processCountry:)]; <-- The selector.
...
...
} // end windowDidBecomeKey()


...
@end



// (C) Setting up NSTableView environment as a category of NSArray:

@implementation NSArray (NSTableDataSource)

- (int)numberOfRowsInTableView:(NSTableView *)aTableView {
    return [self count];
}

- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex {
return [self objectAtIndex: rowIndex];
}


@end

----------

Note: Using the NSTableView methods within the main controller implementation versus using a NSArray category DOES WORK; albeit I have to use a constant integer for the number of rows in the table vs using the array count (doesn't give a full count). I don't know why.

Any ideas?
Thanks in advance.

Ric.

_______________________________________________
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


  • Prev by Date: Re: Custom NSToolbarItem
  • Next by Date: Re: newbie memory question
  • Previous by thread: Re: Connecting a progress bar to standard C code?
  • Next by thread: Control an applications file system calls
  • Index(es):
    • Date
    • Thread