|
1 | 1 | #import "WPNUXSecondaryButton.h" |
| 2 | +#import <UIKit/UIKit.h> |
2 | 3 | @import WordPressSharedObjC; |
3 | 4 |
|
4 | 5 |
|
@@ -31,25 +32,34 @@ - (void)sizeToFit |
31 | 32 |
|
32 | 33 | // Adjust frame to account for the edge insets |
33 | 34 | CGRect frame = self.frame; |
34 | | - frame.size.width += self.titleEdgeInsets.left + self.titleEdgeInsets.right; |
| 35 | + frame.size.width += self.configuration.contentInsets.leading + self.configuration.contentInsets.trailing; |
35 | 36 | self.frame = frame; |
36 | 37 | } |
37 | 38 |
|
38 | 39 | - (CGSize)intrinsicContentSize |
39 | 40 | { |
40 | 41 | CGSize size = [self sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)]; |
41 | | - size.width += self.titleEdgeInsets.left + self.titleEdgeInsets.right; |
| 42 | + size.width += self.configuration.contentInsets.leading + self.configuration.contentInsets.trailing; |
42 | 43 | return size; |
43 | 44 | } |
44 | 45 |
|
45 | 46 | #pragma mark - Private Methods |
46 | 47 |
|
47 | 48 | - (void)configureButton |
48 | 49 | { |
| 50 | + UIButtonConfiguration *config = [UIButtonConfiguration plainButtonConfiguration]; |
| 51 | + config.contentInsets = NSDirectionalEdgeInsetsMake( |
| 52 | + WPNUXSecondaryButtonTitleEdgeInsets.top, |
| 53 | + WPNUXSecondaryButtonTitleEdgeInsets.left, |
| 54 | + WPNUXSecondaryButtonTitleEdgeInsets.bottom, |
| 55 | + WPNUXSecondaryButtonTitleEdgeInsets.right |
| 56 | + ); |
| 57 | + self.configuration = config; |
| 58 | + |
49 | 59 | self.titleLabel.font = [WPFontManager systemRegularFontOfSize:15.0]; |
50 | 60 | self.titleLabel.minimumScaleFactor = 10.0/15.0; |
51 | 61 | self.titleLabel.adjustsFontSizeToFitWidth = YES; |
52 | | - [self setTitleEdgeInsets:WPNUXSecondaryButtonTitleEdgeInsets]; |
| 62 | + |
53 | 63 | [self setTitleColor:[UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0] forState:UIControlStateNormal]; |
54 | 64 | [self setTitleColor:[UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.4] forState:UIControlStateHighlighted]; |
55 | 65 | } |
|
0 commit comments