Skip to content

Instantly share code, notes, and snippets.

@jlebrech
Created December 31, 2010 11:07
Show Gist options
  • Save jlebrech/760936 to your computer and use it in GitHub Desktop.
Save jlebrech/760936 to your computer and use it in GitHub Desktop.
@implementation ProjectsView : CPView
{
CPTableView projectsTable;
}
- (id)initWithFrame:(CPRect)frame
{
self = [super initWithFrame:frame];
// create the CPTableView
projectsTable = [[CPTableView alloc] initWithFrame:[self bounds]];
[projectsTable setDataSource:self];
[projectsTable setDelegate:self];
[projectsTable setUsesAlternatingRowBackgroundColors:YES];
[projectsTable setAlternatingRowBackgroundColors:[CPArray arrayWithObjects:[CPColor whiteColor],[CPColor redColor]]];
var headerColor = [CPColor colorWithPatternImage:[[CPImage alloc] initWithContentsOfFile:[[CPBundle mainBundle] pathForResource:@"button-bezel-center.png"]]];
[[projectsTable cornerView] setBackgroundColor:headerColor];
// add the first column
var column = [[CPTableColumn alloc] initWithIdentifier:@"Project"];
[[column headerView] setStringValue:"Project Name"];
[[column headerView] setBackgroundColor:headerColor];
[column setWidth:200.0];
[projectsTable addTableColumn:column];
[self addSubview:projectsTable];
}
- (id)tableView:(CPTableView)tableView objectValueForTableColumn:(CPTableColumn)tableColumn row:(int)row
{
return @"foo";
}
// CPTableView datasource methods
- (int)numberOfRowsInTableView:(CPTableView)tableView
{
return 1;
}
@end
@jlebrech
Copy link
Author

this is when i add it to the main view list this

projectsView = [[ProjectsView alloc] initWithFrame:[leftView bounds]];
[leftView addSubview:projectsView];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment