@@ -71,6 +71,7 @@ - (void)initViews {
71
71
_closeButton.userInteractionEnabled = YES ;
72
72
_closeButton.clipsToBounds = YES ;
73
73
_closeButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin;
74
+ _closeButton.contentMode = UIViewContentModeCenter;
74
75
[_closeButton addTarget: self action: @selector (closeButtonTapped: ) forControlEvents: UIControlEventTouchUpInside];
75
76
76
77
[self addSubview: _closeButton];
@@ -108,14 +109,14 @@ - (void)layoutSubviews {
108
109
CGSize labelSize = [_labelView sizeThatFits: bounds.size];
109
110
_labelView.preferredMaxLayoutWidth = _labelView.bounds .size .width ;
110
111
_labelView.frame = CGRectMake (BFMarginX,
111
- CGRectGetMaxY (bounds) - labelSize.height - BFMarginY,
112
+ CGRectGetMaxY (bounds) - labelSize.height - 1.5 * BFMarginY,
112
113
CGRectGetMaxX (bounds) - BFCloseButtonWidth - 3 * BFMarginX,
113
- labelSize.height );
114
+ labelSize.height + BFMarginY );
114
115
115
- _closeButton.frame = CGRectMake (CGRectGetMaxX (bounds) - BFCloseButtonWidth - BFMarginX,
116
- _labelView.center .y - BFCloseButtonHeight / 2.0 ,
117
- BFCloseButtonWidth,
118
- BFCloseButtonHeight);
116
+ _closeButton.frame = CGRectMake (CGRectGetMaxX (bounds) - BFCloseButtonWidth - 2 * BFMarginX,
117
+ _labelView.center .y - BFCloseButtonHeight / 2.0 - BFMarginY ,
118
+ BFCloseButtonWidth + 2 * BFMarginX ,
119
+ BFCloseButtonHeight + 2 * BFMarginY );
119
120
}
120
121
121
122
- (CGSize )sizeThatFits : (CGSize )size {
@@ -169,7 +170,7 @@ - (void)updateColors {
169
170
UIImage *closeButtonImage = [self drawCloseButtonImageWithColor: _textColor];
170
171
171
172
_labelView.textColor = _textColor;
172
- [_closeButton setBackgroundImage : closeButtonImage forState: UIControlStateNormal];
173
+ [_closeButton setImage : closeButtonImage forState: UIControlStateNormal];
173
174
}
174
175
175
176
- (UIImage *)drawCloseButtonImageWithColor : (UIColor *)color {
0 commit comments