Created
May 6, 2011 03:58
-
-
Save chrishulbert/958426 to your computer and use it in GitHub Desktop.
Centered header on a uitableview
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
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { | |
UILabel *lbl = [[[UILabel alloc] init] autorelease]; | |
lbl.textAlignment = UITextAlignmentCenter; | |
lbl.font = [UIFont fontWithName:@"Helvetica-Bold" size:18]; | |
lbl.text = @"My Centered Header"; | |
lbl.textColor = [UIColor whiteColor]; | |
lbl.shadowColor = [UIColor grayColor]; | |
lbl.shadowOffset = CGSizeMake(0,1); | |
lbl.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"my_head_bg"]]; | |
lbl.alpha = 0.9; | |
return lbl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment