Skip to content

Commit

Permalink
Merge pull request #77 from JosephEarl/bug/refererview-hittargets
Browse files Browse the repository at this point in the history
Increase Size of Hit Targets on BFAppLinkRefererView
  • Loading branch information
nlutsenko committed Jan 27, 2015
2 parents 50b3310 + 8f1bb4a commit 35f21ff
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Bolts/iOS/BFAppLinkReturnToRefererView.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ - (void)initViews {
_closeButton.userInteractionEnabled = YES;
_closeButton.clipsToBounds = YES;
_closeButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin;
_closeButton.contentMode = UIViewContentModeCenter;
[_closeButton addTarget:self action:@selector(closeButtonTapped:) forControlEvents:UIControlEventTouchUpInside];

[self addSubview:_closeButton];
Expand Down Expand Up @@ -108,14 +109,14 @@ - (void)layoutSubviews {
CGSize labelSize = [_labelView sizeThatFits:bounds.size];
_labelView.preferredMaxLayoutWidth = _labelView.bounds.size.width;
_labelView.frame = CGRectMake(BFMarginX,
CGRectGetMaxY(bounds) - labelSize.height - BFMarginY,
CGRectGetMaxY(bounds) - labelSize.height - 1.5 * BFMarginY,
CGRectGetMaxX(bounds) - BFCloseButtonWidth - 3 * BFMarginX,
labelSize.height);
labelSize.height + BFMarginY);

_closeButton.frame = CGRectMake(CGRectGetMaxX(bounds) - BFCloseButtonWidth - BFMarginX,
_labelView.center.y - BFCloseButtonHeight / 2.0,
BFCloseButtonWidth,
BFCloseButtonHeight);
_closeButton.frame = CGRectMake(CGRectGetMaxX(bounds) - BFCloseButtonWidth - 2 * BFMarginX,
_labelView.center.y - BFCloseButtonHeight / 2.0 - BFMarginY,
BFCloseButtonWidth + 2 * BFMarginX,
BFCloseButtonHeight + 2 * BFMarginY);
}

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

_labelView.textColor = _textColor;
[_closeButton setBackgroundImage:closeButtonImage forState:UIControlStateNormal];
[_closeButton setImage:closeButtonImage forState:UIControlStateNormal];
}

- (UIImage *)drawCloseButtonImageWithColor:(UIColor *)color {
Expand Down

0 comments on commit 35f21ff

Please sign in to comment.