Skip to content

Instantly share code, notes, and snippets.

@maddox
Created August 10, 2008 04:37
Show Gist options
  • Save maddox/4723 to your computer and use it in GitHub Desktop.
Save maddox/4723 to your computer and use it in GitHub Desktop.
//
// DataSrc.m
// summizer
//
// Created by Jon Maddox on 8/6/08.
// Copyright 2008 Mustache, Inc.. All rights reserved.
//
#import "DataSrc.h"
@implementation DataSrc
- (id)initWithArray:(NSArray *)array
{
[super init];
aBuffer = array;
return self;
}
// The data-source protocol methods
- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
return [aBuffer count];
}
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
id theRecord, theValue;
NSParameterAssert(rowIndex >= 0 && rowIndex < [aBuffer count]);
theRecord = [aBuffer objectAtIndex:rowIndex];
theValue = [theRecord objectForKey:[aTableColumn identifier]];
NSLog(@"%@", [aTableColumn headerCell]);
return theValue;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment