Created
January 22, 2011 16:43
-
-
Save mikecsh/791232 to your computer and use it in GitHub Desktop.
Cappuccino CPTableView Issues
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
@import <Foundation/CPObject.j> | |
@implementation AppController : CPObject | |
{ | |
CPTableView _tableView; | |
} | |
- (void)applicationDidFinishLaunching:(CPNotification)aNotification | |
{ | |
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask], | |
contentView = [theWindow contentView]; | |
// Create a CPScrollView that will contain the CPTableView | |
var scrollView = [[CPScrollView alloc] initWithFrame:[contentView frame]]; | |
[scrollView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; | |
[scrollView setHasHorizontalScroller:YES]; | |
// Create the CPTableView | |
_tableView = [[CPTableView alloc] initWithFrame:[scrollView bounds]]; | |
[_tableView setDataSource:self]; | |
[_tableView setUsesAlternatingRowBackgroundColors:YES]; | |
// Uncomment this line to test vertical scrollbar issue.. | |
//[_tableView setHeaderView:nil]; | |
// Add some columns | |
for (var columnIndex=0; columnIndex < 25; ++columnIndex) | |
{ | |
var column = [[CPTableColumn alloc] initWithIdentifier:[columnIndex]]; | |
[[column headerView] setStringValue:@"Test Header"]; | |
[column setWidth:100.0]; | |
[_tableView addTableColumn:column]; | |
} | |
// View hierarchy | |
[scrollView setDocumentView:_tableView]; | |
[contentView addSubview:scrollView]; | |
[theWindow orderFront:self]; | |
} | |
- (int)numberOfRowsInTableView:(CPTableView)tableView | |
{ | |
return 500; | |
} | |
- (id)tableView:(CPTableView)tableView objectValueForTableColumn:(CPTableColumn)tableColumn row:(int)row | |
{ | |
return @"Test Data"; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment