TableView question? (newbie)
TableView question? (newbie)
- Subject: TableView question? (newbie)
- From: Rich <email@hidden>
- Date: Fri, 5 Sep 2003 19:57:36 -0700 (PDT)
Ok, here is my present problem:
I am trying to get my tableView to compare data and reorganize when the user clicks on the column
title. I used a tutorial to get where I am, and if I don't try to make my addbutton add data from
a field, but just have it input a new line in the TableView the comparison works. When I try to
make my button do what I want it to do, add from a field, it gives me the following errors:
2003-09-05 20:51:16.392 MovieShelfBasic[2197] *** -[NSCFDictionary compareTitle:]: selector not
recognized
2003-09-05 20:51:16.393 MovieShelfBasic[2197] *** -[NSCFDictionary compareTitle:]: selector not
recognized
*** Oddly it doesn't cuss at me if I use my code and leave the input field blank, then try to
sort. It obviously doesn't do any moving at all cause there isn't any info to compare to.
here is my code so far, all that is important anyway.
- (NSDictionary *)createRecord
{
NSMutableDictionary * record = [[NSMutableDictionary alloc] init];
[record setObject:[titleField stringValue] forKey:@"title"];
[record autorelease];
return record;
}
- (IBAction)addButton:(id)sender
{
[items insertObject:[self createRecord] atIndex:0]; *** if I use these it swears at me
[tableView reloadData]; *** of course, they are mine after
} all
/*ShelfItem * item = [[ShelfItem alloc] init]; *** if I leave these lines active and take out my
lines it works
[items insertObject:item atIndex:0];
[item release];
[tableView reloadData];
[tableView selectRow:0 byExtendingSelection:NO];
}*/
.
.
.
.
- (void)tableView:(NSTableView *)aTableView
didClickTableColumn:(NSTableColumn *)tableColumn
{
NSString * identifier = [tableColumn identifier];
if ([identifier isEqualToString:@"title"])
{
[items sortUsingSelector:@selector(compareTitle:)];
}//else {
// [items sortUsingSelector:@selector(compare ---:)];
//}
[tableView reloadData];
}
Thanks for the help in advance,
Rich
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.