Skip to content

Instantly share code, notes, and snippets.

@alexeckermann
Created August 15, 2010 11:46
Show Gist options
  • Save alexeckermann/525409 to your computer and use it in GitHub Desktop.
Save alexeckermann/525409 to your computer and use it in GitHub Desktop.
/*
Example custom UIView implementation
------------------------------------
Used as a custom UITableView header cell.
*/
- (id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
userName = [[UILabel alloc] initWithFrame:CGRectMake(70, 16, (self.bounds.size.width - 70), 28)];
[userName setNumberOfLines: 1];
[userName setFont: [UIFont boldSystemFontOfSize:20.0]];
[userName setContentMode:UIViewContentModeLeft];
[userName setOpaque: NO];
[userName setBackgroundColor:[UIColor clearColor]];
[userName setTextColor:[UIColor colorWithHue:0.5611 saturation:0.92 brightness:0.66 alpha:1]];
[userName setShadowColor:[UIColor colorWithHue:1 saturation:0 brightness:1 alpha:0.6]];
[userName setShadowOffset: CGSizeMake(1, 1)];
[userName setText: @"Loading..."];
[self addSubview: userName];
avatar = [[UIImageView alloc] initWithFrame:CGRectMake(12, 17, 46, 46)];
[avatar setImage:[UIImage imageNamed:@"default-avatar.png"]];
[avatar setOpaque: NO];
[avatar setBackgroundColor:[UIColor clearColor]];
[self addSubview: avatar];
[self setBackgroundColor:[UIColor clearColor]];
}
return self;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment