Created
January 26, 2011 19:53
-
-
Save fredriktelenius/797315 to your computer and use it in GitHub Desktop.
Default header font in 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
-(id) initWithHeader:(NSString*) header { | |
if (self = [super initWithFrame:CGRectMake(0.0, 0.0, 320.0, 40.0)]) { | |
CGSize stringBoundingBox = [header sizeWithFont:[UIFont boldSystemFontOfSize:17]]; | |
[self setBackgroundColor:[UIColor groupTableViewBackgroundColor]]; | |
self.activityIndicator = [[UIActivityIndicatorView alloc] | |
initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; | |
CGRect frame = [self.activityIndicator frame]; | |
frame.origin.x = stringBoundingBox.width + 30.0; | |
frame.origin.y = 17.0; | |
[self.activityIndicator setFrame:frame]; | |
[self addSubview:self.activityIndicator]; | |
[self.activityIndicator startAnimating]; | |
// create the title | |
self.label = [[UILabel alloc] | |
initWithFrame:CGRectMake(20.0, 13.0, stringBoundingBox.width, 30.0)]; | |
self.label.text = header; | |
self.label.font = [UIFont boldSystemFontOfSize:17]; | |
self.label.shadowColor = [UIColor colorWithWhite:1.0 alpha:1.0]; | |
self.label.shadowOffset = CGSizeMake(0, 1); | |
self.label.textColor = [UIColor colorWithRed:0.265 green:0.294 blue:0.367 alpha:1.0]; | |
[self.label setBackgroundColor:[UIColor clearColor]]; | |
[self addSubview:self.label]; | |
} | |
return self; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment