Skip to content

Commit 6ec09f8

Browse files
committed
Update FAButton.m
1 parent defd4f5 commit 6ec09f8

File tree

1 file changed

+16
-2
lines changed
  • FontAwesomeIconFactory-Extensions/Button

1 file changed

+16
-2
lines changed

FontAwesomeIconFactory-Extensions/Button/FAButton.m

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
@interface FAButton(){
1212
NIKFontAwesomeIcon _icon;
13+
NSInteger _iconSize;
1314
}
1415

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

1920
@implementation FAButton
2021

22+
23+
2124
- (void)awakeFromNib
2225
{
2326
[super awakeFromNib];
@@ -27,12 +30,22 @@ - (void)awakeFromNib
2730
}
2831

2932
- (void)setIcon:(NIKFontAwesomeIcon)icon {
33+
34+
if (_iconSize == 0){
35+
_iconSize = (NSInteger) (self.bounds.size.height *0.8);
36+
}
37+
[self setIcon:icon withSize:_iconSize];
38+
39+
}
40+
41+
- (void)setIcon:(NIKFontAwesomeIcon)icon withSize:(float)size {
42+
3043
_icon = icon;
44+
_iconSize = size;
3145
NIKFontAwesomeIconFactory *factory = [NIKFontAwesomeIconFactory buttonIconFactory];
3246
[factory setColors:@[self.tintColor]];
33-
[factory setSize:self.bounds.size.height *0.8];
47+
[factory setSize:_iconSize];
3448
[self setImage:[factory createImageForIcon:icon] forState:UIControlStateNormal];
35-
3649

3750
}
3851

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

5669
@end
70+

0 commit comments

Comments
 (0)