Created
July 25, 2008 08:34
-
-
Save zmalltalker/2414 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "AppController.h" | |
#import "Person.h" | |
@implementation AppController | |
-(id)init | |
{ | |
NSLog(@"Initializing"); | |
people = [Person findAll]; | |
return self; | |
} | |
-(int)numberOfRowsInTableView:(NSTableView *)tv | |
{ | |
return [people count]; | |
} | |
-(id)tableView:(NSTableView *)tv | |
objectValueForTableColumn:(NSTableColumn *)tableColumn | |
row:(int)row | |
{ | |
Person *currentPerson = [people objectAtIndex:row]; | |
return [currentPerson valueForKey:[tableColumn identifier]]; | |
} | |
-(void)tableViewSelectionDidChange:(NSNotification *)notification | |
{ | |
NSLog(@"Selection changed"); | |
int row = [tableView selectedRow]; | |
if (row == -1) | |
{ | |
return; | |
} | |
Person *currentPerson = [people objectAtIndex:row]; | |
NSString *bio = [currentPerson valueForKey:@"bio"]; | |
[detailView setStringValue:bio]; | |
} | |
@end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment