//
//  SCCustomizableButton.m
//  StickyCollectionView
//
//  Created by Bogdan Matveev on 07.12.15.
//  Copyright 漏 2015 Bogdan Matveev. All rights reserved.
//

#import "SCCustomizableButton.h"

@interface SCCustomizableButton()
@property (nonatomic, assign) IBInspectable CGFloat cornerRadius;
@property (nonatomic, assign) IBInspectable CGFloat borderWidth;
@property (nonatomic, assign) IBInspectable CGFloat horizontalPadding;
@property (nonatomic, strong) IBInspectable UIColor *borderColor;
@end

@implementation SCCustomizableButton

- (void)layoutSubviews {
    [super layoutSubviews];
    
    if (self.borderWidth) {
        self.layer.masksToBounds = YES;
        self.layer.borderWidth = self.borderWidth;
    }
    self.layer.cornerRadius = self.cornerRadius;
    self.layer.borderColor = self.borderColor.CGColor;
}

- (CGSize) intrinsicContentSize {
    CGSize contentSize = [super intrinsicContentSize] ;
    contentSize.width += self.horizontalPadding * 2 ;
    return contentSize ;
}

@end
// 鐗堟潈灞炰簬鍘熶綔鑰?// http://code4app.com (cn) http://code4app.net (en)
// 鍙戝竷浠g爜浜庢渶涓撲笟鐨勬簮鐮佸垎浜綉绔? Code4App.com