Skip to content

Commit

Permalink
Update FAButton.m
Browse files Browse the repository at this point in the history
  • Loading branch information
tonimoeckel committed Dec 4, 2014
1 parent defd4f5 commit 6ec09f8
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions FontAwesomeIconFactory-Extensions/Button/FAButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

@interface FAButton(){
NIKFontAwesomeIcon _icon;
NSInteger _iconSize;
}

@property (nonatomic, strong) CAShapeLayer *circleLayer;
Expand All @@ -18,6 +19,8 @@ @interface FAButton(){

@implementation FAButton



- (void)awakeFromNib
{
[super awakeFromNib];
Expand All @@ -27,12 +30,22 @@ - (void)awakeFromNib
}

- (void)setIcon:(NIKFontAwesomeIcon)icon {

if (_iconSize == 0){
_iconSize = (NSInteger) (self.bounds.size.height *0.8);
}
[self setIcon:icon withSize:_iconSize];

}

- (void)setIcon:(NIKFontAwesomeIcon)icon withSize:(float)size {

_icon = icon;
_iconSize = size;
NIKFontAwesomeIconFactory *factory = [NIKFontAwesomeIconFactory buttonIconFactory];
[factory setColors:@[self.tintColor]];
[factory setSize:self.bounds.size.height *0.8];
[factory setSize:_iconSize];
[self setImage:[factory createImageForIcon:icon] forState:UIControlStateNormal];


}

Expand All @@ -54,3 +67,4 @@ - (void)drawCircleButton:(UIColor *)color fill:(UIColor *)fillColor
}

@end

0 comments on commit 6ec09f8

Please sign in to comment.