Created
October 26, 2009 02:47
-
-
Save rentzsch/218398 to your computer and use it in GitHub Desktop.
This file contains 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
- (void)windowDidLoad { | |
var window = [self window], | |
contentView = [window contentView], | |
contextViewSize = [contentView bounds].size, | |
scrollSize = CGSizeMake(contextViewSize.width - (20*2), contextViewSize.height - 70), | |
scrollFrame = CGRectMake(20, 20, scrollSize.width, scrollSize.height), | |
tableFrame = CGRectMake(0, 0, scrollSize.width, scrollSize.height), | |
tableView = [[CPTableView alloc] initWithFrame:tableFrame], | |
nameColumn = [[CPTableColumn alloc] initWithIdentifier:'name'], | |
yearColumn = [[CPTableColumn alloc] initWithIdentifier:'year'], | |
scrollView = [[CPScrollView alloc] initWithFrame:scrollFrame], | |
headerColor = [CPColor colorWithHexString:'e5e5e5']; | |
[[nameColumn headerView] setStringValue:'mexico-copper-canyon']; | |
[[nameColumn headerView] sizeToFit]; | |
[nameColumn setWidth:[[nameColumn headerView] frame].size.width]; | |
[[nameColumn headerView] setStringValue:'Name']; | |
[nameColumn setResizingMask:CPTableColumnUserResizingMask]; | |
[tableView addTableColumn:nameColumn]; | |
[[yearColumn headerView] setStringValue:'8888']; | |
[[yearColumn headerView] sizeToFit]; | |
[yearColumn setWidth:[[yearColumn headerView] frame].size.width]; | |
[[yearColumn headerView] setStringValue:'Year']; | |
[yearColumn setResizingMask:CPTableColumnUserResizingMask]; | |
[tableView addTableColumn:yearColumn]; | |
[[tableView cornerView] setBackgroundColor:headerColor]; | |
[[tableView headerView] setBackgroundColor:headerColor]; | |
[tableView setBackgroundColor:[CPColor whiteColor]]; | |
[tableView setDelegate:self]; | |
[tableView setDataSource:self]; | |
[scrollView setDocumentView:tableView]; | |
[scrollView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; | |
[scrollView setAutohidesScrollers:YES]; | |
[[window contentView] addSubview:scrollView]; | |
[addCalendarButton setImage:[[CPImage alloc] initByReferencingFile:'Resources/add.gif' size:CGSizeMake(8,8)]]; | |
[removeCalendarButton setImage:[[CPImage alloc] initByReferencingFile:'Resources/remove.gif' size:CGSizeMake(8,2)]]; | |
} | |
- (int)numberOfRowsInTableView:(CPTableView)tableView { | |
return 50; | |
} | |
- (id)tableView:(CPTableView)tableView_ objectValueForTableColumn:(CPTableColumn)column_ row:(CPInteger)row_ { | |
if ([[column_ identifier] isEqualToString:'name']) { | |
return [column_ identifier] + ' ' + row_; | |
} else { | |
return '2010'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment