Skip to content

Instantly share code, notes, and snippets.

@maxehmookau
Created November 25, 2012 18:28
Show Gist options
  • Save maxehmookau/4144696 to your computer and use it in GitHub Desktop.
Save maxehmookau/4144696 to your computer and use it in GitHub Desktop.
Nice UIButton
//
// SUButton.h
// SussexStudentsUnion
//
// Created by Max Woolf on 02/11/2012.
// Copyright (c) 2012 USSU. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SUButton : UIButton
@end
//
// SUButton.m
// SussexStudentsUnion
//
// Created by Max Woolf on 02/11/2012.
// Copyright (c) 2012 USSU. All rights reserved.
//
#import "SUButton.h"
#import <QuartzCore/QuartzCore.h>
@implementation SUButton
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self.titleLabel setFont:[UIFont fontWithName:@"MuseoSlab-500" size:16] ];
CAGradientLayer *contactGradient = [CAGradientLayer layer];
contactGradient.frame = self.bounds;
contactGradient.colors = [NSArray arrayWithObjects:(id)[[UIColor colorWithRed:0.45 green:0.45 blue:0.45 alpha:0.65] CGColor], (id)[[UIColor colorWithHue:0 saturation:0 brightness:0 alpha:0.65] CGColor], nil];
[self.layer setBorderWidth:0.5f];
[self.layer setCornerRadius:10.0f];
[contactGradient setBorderWidth:0.5f];
[contactGradient setCornerRadius:10.0f];
[self.layer insertSublayer:contactGradient atIndex:0];
}
return self;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment