Skip to content

Instantly share code, notes, and snippets.

@SquaredTiki
Created April 25, 2010 06:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SquaredTiki/378211 to your computer and use it in GitHub Desktop.
Save SquaredTiki/378211 to your computer and use it in GitHub Desktop.
- (id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
[self setBackgroundImage:[UIImage imageWithContentsOfFile: [[NSBundle mainBundle]
pathForResource:@"TransparentButtonFillN"
ofType:@"png"]]
forState:UIControlStateNormal];
}
return self;
}
- (CGRect)backgroundRectForBounds:(CGRect)bounds {
UIImage *imgLeft = [UIImage imageWithContentsOfFile: [[NSBundle mainBundle]
pathForResource:@"TransparentButtonLeftN"
ofType:@"png"]];
UIImage *imgRight = [UIImage imageWithContentsOfFile: [[NSBundle mainBundle]
pathForResource:@"TransparentButtonRightN"
ofType:@"png"]];
UIImageView *imgLeftView = [[UIImageView alloc] initWithImage:imgLeft];
UIImageView *imgRightView = [[UIImageView alloc] initWithImage:imgRight];
imgLeftView.frame = CGRectMake(0, 0, imgLeft.size.width, imgLeft.size.height);
imgRightView.frame = CGRectMake(bounds.size.width - imgRight.size.width, 0, imgRight.size.width, imgRight.size.height);
[self addSubview:imgLeftView];
[self addSubview:imgRightView];
return bounds;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment