Created
September 29, 2011 14:24
-
-
Save grgcombs/1250824 to your computer and use it in GitHub Desktop.
RKTableViewSections from @jeffarena
This file contains hidden or 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
// This would be inserted somewhere in your app-wide tableviewcontroller superclass configuration, to reap the benefits across all subsequent tables. | |
self.tableController.heightForHeaderInSection = 22; | |
self.tableController.onViewForHeaderInSection = ^UIView*(NSUInteger sectionIndex, NSString* sectionTitle) { | |
UIView* headerView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.bounds.size.width, 22)] autorelease]; | |
headerView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"sectionheader_bg.png"]]; | |
UILabel* label = [[UILabel alloc] initWithFrame:CGRectMake(5, 0, self.tableView.bounds.size.width, 22)]; | |
label.text = sectionTitle; | |
label.textColor = [UIColor whiteColor]; | |
label.backgroundColor = [UIColor clearColor]; | |
label.font = [UIFont boldSystemFontOfSize:12]; | |
[headerView addSubview:label]; | |
[label release]; | |
return headerView; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment