Skip to content

Instantly share code, notes, and snippets.

@hatapu
Created November 21, 2015 02:46
Show Gist options
  • Select an option

  • Save hatapu/2bda3c5c68c6624eb8f1 to your computer and use it in GitHub Desktop.

Select an option

Save hatapu/2bda3c5c68c6624eb8f1 to your computer and use it in GitHub Desktop.
Border Rounded UIButton
#import <UIKit/UIKit.h>
IB_DESIGNABLE
@interface BorderButton : UIButton
@property (nonatomic) IBInspectable CGFloat cornerRadius;
@property (nonatomic) IBInspectable UIColor *borderColor;
@property (nonatomic) IBInspectable CGFloat borderWidth;
@end
#import "BorderButton.h"
@implementation BorderButton
- (void)drawRect:(CGRect)rect
{
self.layer.cornerRadius = self.cornerRadius;
self.layer.borderColor = self.borderColor.CGColor;
self.layer.borderWidth = self.borderWidth;
[super drawRect:rect];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment