Hey everyone,
I'm working on learning Objective-C/Coaoa, but I've seem to have gotten a bit stuck with getting the NSTableView object to work for me. I've followed all the directions, but for some reason I still get this error:
Class 'RobotManager' does not implement the 'NSTableViewDataSource' protocol
Here's my source, tell me what you see is wrong here, I'm about to tear my face off.
RobotManager.h
@interface RobotManager : NSObject {
// Interface vars
IBOutlet NSWindow *MainWindow;
IBOutlet NSTableView *RobotTable;
NSMutableArray *RobotList;
}
- (int) numberOfRowsInTableView: (NSTableView*) tableView;
- (id) tableView:(NSTableView *) tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)rowIndex;
@end
RobotManager.m
#import "RobotManager.h"
@implementation RobotManager
-(void) awakeFromNib {
// Generate some dummy vals
[RobotList addObject:@"Hello"];
[RobotList addObject:@"World"];
[RobotTable setDataSource:self]; // This is where I'm getting the protocol warning
[RobotTable reloadData];
}
-(int) numberOfRowsInTableView: (NSTableView *) tableView {
return [RobotList count];
}
-(id) tableView:(NSTableView *) tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)rowIndex {
return [RobotList objectAtIndex:rowIndex];
}
@end
I'm running OS X 10.6.1 if that makes any difference. Thanks in advance.