Skip to content

Instantly share code, notes, and snippets.

@boucher
Created December 1, 2010 20:21
Show Gist options
  • Save boucher/724145 to your computer and use it in GitHub Desktop.
Save boucher/724145 to your computer and use it in GitHub Desktop.
diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j
index a808ebe..3a8e0a0 100644
--- a/AppKit/CPTableView.j
+++ b/AppKit/CPTableView.j
@@ -243,6 +243,8 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
if (self)
{
+ [self _init];
+
//Configuring Behavior
_allowsColumnReordering = YES;
_allowsColumnResizing = YES;
@@ -288,7 +290,6 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
_destinationDragStyle = CPTableViewDraggingDestinationFeedbackStyleRegular;
[self setBackgroundColor:[CPColor whiteColor]];
- [self _init];
}
return self;
@@ -308,8 +309,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
_lastColumnShouldSnap = NO;
- if (!_alternatingRowBackgroundColors)
- _alternatingRowBackgroundColors = [[CPColor whiteColor], [CPColor colorWithHexString:@"e4e7ff"]];
+ [self setAlternatingRowBackgroundColors:[[CPColor whiteColor], [CPColor colorWithHexString:@"e4e7ff"]]];
_selectionHighlightColor = [CPColor colorWithHexString:@"5f83b9"];
@@ -332,13 +332,10 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
[_tableDrawView setBackgroundColor:[CPColor clearColor]];
[self addSubview:_tableDrawView];
- if (!_headerView)
- _headerView = [[CPTableHeaderView alloc] initWithFrame:CGRectMake(0, 0, [self bounds].size.width, _rowHeight)];
-
+ _headerView = [[CPTableHeaderView alloc] initWithFrame:CGRectMake(0, 0, [self bounds].size.width, _rowHeight)];
[_headerView setTableView:self];
- if (!_cornerView)
- _cornerView = [[_CPCornerView alloc] initWithFrame:CGRectMake(0, 0, [CPScroller scrollerWidth], CGRectGetHeight([_headerView frame]))];
+ _cornerView = [[_CPCornerView alloc] initWithFrame:CGRectMake(0, 0, [CPScroller scrollerWidth], CGRectGetHeight([_headerView frame]))];
_draggedColumn = nil;
@@ -3828,6 +3825,8 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey",
if (self)
{
+ [self _init];
+
//Configuring Behavior
_allowsColumnReordering = [aCoder decodeBoolForKey:CPTableViewColumnReorderingKey];
_allowsColumnResizing = [aCoder decodeBoolForKey:CPTableViewColumnResizingKey];
@@ -3866,8 +3865,6 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey",
[self setDataSource:[aCoder decodeObjectForKey:CPTableViewDataSourceKey]];
[self setDelegate:[aCoder decodeObjectForKey:CPTableViewDelegateKey]];
- [self _init];
-
[self viewWillMoveToSuperview:[self superview]];
// Do this as late as possible to make sure the tableview is fully configured
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment