Skip to content

Commit 35f21ff

Browse files
committed
Merge pull request #77 from JosephEarl/bug/refererview-hittargets
Increase Size of Hit Targets on BFAppLinkRefererView
2 parents 50b3310 + 8f1bb4a commit 35f21ff

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

Bolts/iOS/BFAppLinkReturnToRefererView.m

+8-7
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ - (void)initViews {
7171
_closeButton.userInteractionEnabled = YES;
7272
_closeButton.clipsToBounds = YES;
7373
_closeButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin;
74+
_closeButton.contentMode = UIViewContentModeCenter;
7475
[_closeButton addTarget:self action:@selector(closeButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
7576

7677
[self addSubview:_closeButton];
@@ -108,14 +109,14 @@ - (void)layoutSubviews {
108109
CGSize labelSize = [_labelView sizeThatFits:bounds.size];
109110
_labelView.preferredMaxLayoutWidth = _labelView.bounds.size.width;
110111
_labelView.frame = CGRectMake(BFMarginX,
111-
CGRectGetMaxY(bounds) - labelSize.height - BFMarginY,
112+
CGRectGetMaxY(bounds) - labelSize.height - 1.5 * BFMarginY,
112113
CGRectGetMaxX(bounds) - BFCloseButtonWidth - 3 * BFMarginX,
113-
labelSize.height);
114+
labelSize.height + BFMarginY);
114115

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);
119120
}
120121

121122
- (CGSize)sizeThatFits:(CGSize)size {
@@ -169,7 +170,7 @@ - (void)updateColors {
169170
UIImage *closeButtonImage = [self drawCloseButtonImageWithColor:_textColor];
170171

171172
_labelView.textColor = _textColor;
172-
[_closeButton setBackgroundImage:closeButtonImage forState:UIControlStateNormal];
173+
[_closeButton setImage:closeButtonImage forState:UIControlStateNormal];
173174
}
174175

175176
- (UIImage *)drawCloseButtonImageWithColor:(UIColor *)color {

0 commit comments

Comments
 (0)