Revision: 12379
Updated Code
at March 12, 2009 15:48 by Netzach
Updated Code
- (void) tableViewSelectionDidChange: (NSNotification *) notification{ if ([tableView selectedRow] != -1) { NSString *string = [[array objectAtIndex:[tableView selectedRow]] value]; // Do something } } - (int) numberOfRowsInTableView:(NSTableView *)tableView{ return [array count]; } - (id) tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex{ NSString *valueToDisplay = [[NSString alloc] init]; if (![[aTableColumn identifier] compare:@"Column 1"]) { valueToDisplay = [[array objectAtIndex:rowIndex] value1]; }else if (![[aTableColumn identifier] compare:@"Column 2"]) { valueToDisplay = [[array objectAtIndex:rowIndex] value2]; }else{ valueToDisplay = @"ERROR!"; } return valueToDisplay; }
Revision: 12378
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 12, 2009 15:46 by Netzach
Initial Code
- (void) tableViewSelectionDidChange: (NSNotification *) notification{ if ([tableView selectedRow] != -1) { NSString *string = [[array objectAtIndex:[tableView selectedRow]] value]; // Do something } } - (int)numberOfRowsInTableView:(NSTableView *)tableView{ return [array count]; } - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex{ NSString *valueToDisplay = [[NSString alloc] init]; if (![[aTableColumn identifier] compare:@"Column 1"]) { valueToDisplay = [[array objectAtIndex:rowIndex] value1]; }else if (![[aTableColumn identifier] compare:@"Column 2"]) { valueToDisplay = [[array objectAtIndex:rowIndex] value2]; }else{ valueToDisplay = @"ERROR!"; } return valueToDisplay; }
Initial URL
Initial Description
Initial Title
Basic NSTableView Control Functions
Initial Tags
Initial Language
Objective C