Created
December 3, 2010 10:48
-
-
Save hugithordarson/726821 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 "Controller.h" | |
@implementation Controller | |
- (IBAction)fetch:(id)sender { | |
NSMutableArray *fetchedItems = [NSArray arrayWithContentsOfURL:[NSURL URLWithString:@"http://hugi.karlmenn.is/d/plist.plist" ]]; | |
items = fetchedItems; | |
for( NSDictionary *d in items ) { | |
for( NSString *key in [ d allKeys ] ) { | |
NSTableColumn *column = [table tableColumnWithIdentifier:key ]; | |
if( !column ) { | |
column = [[ NSTableColumn alloc ] initWithIdentifier:key ]; | |
[ [ column headerCell ] setStringValue:key ]; | |
[ table addTableColumn:column ]; | |
} | |
} | |
} | |
[ table reloadData ]; | |
} | |
- (int)numberOfRowsInTableView:(NSTableView *)tableView { | |
return [ items count ]; | |
} | |
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row { | |
return [[ items objectAtIndex:row ] valueForKey:[ tableColumn identifier ] ]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment