File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
FontAwesomeIconFactory-Extensions/Button Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 10
10
11
11
@interface FAButton (){
12
12
NIKFontAwesomeIcon _icon;
13
+ NSInteger _iconSize;
13
14
}
14
15
15
16
@property (nonatomic , strong ) CAShapeLayer *circleLayer;
@@ -18,6 +19,8 @@ @interface FAButton(){
18
19
19
20
@implementation FAButton
20
21
22
+
23
+
21
24
- (void )awakeFromNib
22
25
{
23
26
[super awakeFromNib ];
@@ -27,12 +30,22 @@ - (void)awakeFromNib
27
30
}
28
31
29
32
- (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
+
30
43
_icon = icon;
44
+ _iconSize = size;
31
45
NIKFontAwesomeIconFactory *factory = [NIKFontAwesomeIconFactory buttonIconFactory ];
32
46
[factory setColors: @[self .tintColor]];
33
- [factory setSize: self .bounds.size.height * 0.8 ];
47
+ [factory setSize: _iconSize ];
34
48
[self setImage: [factory createImageForIcon: icon] forState: UIControlStateNormal];
35
-
36
49
37
50
}
38
51
@@ -54,3 +67,4 @@ - (void)drawCircleButton:(UIColor *)color fill:(UIColor *)fillColor
54
67
}
55
68
56
69
@end
70
+
You can’t perform that action at this time.
0 commit comments