Skip to content

Instantly share code, notes, and snippets.

@gekitz
Created May 6, 2012 20:04
Show Gist options
  • Save gekitz/2624119 to your computer and use it in GitHub Desktop.
Save gekitz/2624119 to your computer and use it in GitHub Desktop.
Section Header Button
- (id)initWithFrame:(CGRect)frame {
    if ((self = [super initWithFrame:frame])) {
                UIImage *image = [[SMImageCacher instance] imageWithName:@"sectionHeader"];
                self.textPadding = UIEdgeInsetsMake(0, 10, 0, 90);
                self.font = [UIFont boldSystemFontOfSize:17];
                self.textColor = [UIColor whiteColor];
                self.backgroundColor = [UIColor colorWithPatternImage:image];
                self.shadowOffset = CGSizeMake(0, 1);
                self.shadowColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
                self.userInteractionEnabled = YES;
               
                mMoreButton = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
                mMoreButton.frame = frame;
                mMoreButton.backgroundColor = [UIColor clearColor];
                mMoreButton.titleEdgeInsets = UIEdgeInsetsMake(0, 230, 0, 0);
                [mMoreButton setTitle:NSLocalizedString(@"moreActions",@"") forState:UIControlStateNormal];
                [mMoreButton setTitle:NSLocalizedString(@"moreActions",@"") forState:UIControlStateHighlighted];
                [mMoreButton setTitleColor:RGBCOLOR(140,140,140) forState:UIControlStateNormal];
                [mMoreButton setTitleColor:RGBCOLOR(64,64,64) forState:UIControlStateHighlighted];
                [[mMoreButton titleLabel] setFont:[UIFont boldSystemFontOfSize:15]];
               
                [self addSubview:mMoreButton];
    }
    return self;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment