Skip to content

Instantly share code, notes, and snippets.

@dbrajkovic
Created February 24, 2011 07:53
Show Gist options
  • Save dbrajkovic/841899 to your computer and use it in GitHub Desktop.
Save dbrajkovic/841899 to your computer and use it in GitHub Desktop.
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
// Initialization code here.
var bundle = [CPBundle mainBundle],
leftCapImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:"signin-button-left-cap-up.png"] size:CGSizeMake(5, 42)],
rightCapImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:"signin-button-right-cap-up.png"] size:CGSizeMake(5, 42)],
centerImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:"signin-button-center-up.png"] size:CGSizeMake(93, 42)],
bezelImage = [[CPThreePartImage alloc] initWithImageSlices:[leftCapImage, centerImage, rightCapImage] isVertical:NO],
downleftCapImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:"signin-button-left-cap-down.png"] size:CGSizeMake(5, 42)],
downrightCapImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:"signin-button-right-cap-down.png"] size:CGSizeMake(5, 42)],
downcenterImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:"signin-button-center-down.png"] size:CGSizeMake(93, 42)],
downBezelImage = [[CPThreePartImage alloc] initWithImageSlices:[downleftCapImage, downcenterImage, downrightCapImage] isVertical:NO];
[self setValue:[CPColor colorWithPatternImage:bezelImage] forThemeAttribute:@"bezel-color"];
[self setValue:[CPColor colorWithPatternImage:downBezelImage] forThemeAttribute:@"bezel-color" inState:CPThemeStateHighlighted];
[self setValue:[CPFont systemFontOfSize:16] forThemeAttribute:@"font"];
[self setValue:CGSizeMake(0.0, 1.0) forThemeAttribute:@"text-shadow-offset"];
[self setValue:[CPColor colorWithCalibratedWhite:79.0 / 255.0 alpha:1.0] forThemeAttribute:@"text-color"];
[self setValue:[CPColor colorWithCalibratedWhite:240.0 / 255.0 alpha:1.0] forThemeAttribute:@"text-shadow-color"];
}
return self;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment