forked from organicmaps/organicmaps
Fixed ad banner highlighting
This commit is contained in:
parent
70d8e11ee2
commit
1be1f332ca
3 changed files with 5 additions and 32 deletions
|
@ -136,27 +136,10 @@ final class AdBanner: UITableViewCell {
|
|||
default: assert(false)
|
||||
}
|
||||
}
|
||||
|
||||
@objc func highlightButton() {
|
||||
adCallToActionButtonDetailed.setBackgroundImage(nil, for: .normal)
|
||||
adCallToActionButtonCompact.setBackgroundImage(nil, for: .normal)
|
||||
|
||||
adCallToActionButtonDetailed.backgroundColor = UIColor.bannerButtonBackground()
|
||||
adCallToActionButtonCompact.backgroundColor = UIColor.bannerBackground()
|
||||
let duration = 0.5 * kDefaultAnimationDuration
|
||||
let darkerPercent: CGFloat = 0.2
|
||||
UIView.animate(withDuration: duration, animations: {
|
||||
self.adCallToActionButtonDetailed.backgroundColor = UIColor.bannerButtonBackground().darker(percent: darkerPercent)
|
||||
self.adCallToActionButtonCompact.backgroundColor = UIColor.bannerBackground().darker(percent: darkerPercent)
|
||||
}, completion: { _ in
|
||||
UIView.animate(withDuration: duration, animations: {
|
||||
self.adCallToActionButtonDetailed.backgroundColor = UIColor.bannerButtonBackground()
|
||||
self.adCallToActionButtonCompact.backgroundColor = UIColor.bannerBackground()
|
||||
}, completion: { _ in
|
||||
self.adCallToActionButtonDetailed.setBackgroundColor(UIColor.bannerButtonBackground(), for: .normal)
|
||||
self.adCallToActionButtonCompact.setBackgroundColor(UIColor.bannerBackground(), for: .normal)
|
||||
})
|
||||
})
|
||||
|
||||
override func setHighlighted(_ highlighted: Bool, animated: Bool) {
|
||||
adCallToActionButtonCompact.isHighlighted = highlighted;
|
||||
adCallToActionButtonDetailed.isHighlighted = highlighted;
|
||||
}
|
||||
|
||||
private func configFBBanner(ad: FBNativeAd) {
|
||||
|
|
|
@ -10,7 +10,7 @@ CGFloat const kTopOffset = 36;
|
|||
CGFloat const kBottomOffset = 36;
|
||||
} // namespace
|
||||
|
||||
@interface MWMiPadPlacePageLayoutImpl ()<UITableViewDelegate>
|
||||
@interface MWMiPadPlacePageLayoutImpl ()
|
||||
|
||||
@property(nonatomic) CGRect availableArea;
|
||||
|
||||
|
@ -33,7 +33,6 @@ CGFloat const kBottomOffset = 36;
|
|||
_ownerView = ownerView;
|
||||
_availableArea = ownerView.frame;
|
||||
[self setPlacePageView:placePageView];
|
||||
placePageView.tableView.delegate = self;
|
||||
_delegate = delegate;
|
||||
[self addShadow];
|
||||
}
|
||||
|
@ -162,14 +161,6 @@ CGFloat const kBottomOffset = 36;
|
|||
|
||||
- (CGFloat)topBound { return self.availableArea.origin.y + kTopOffset; }
|
||||
- (CGFloat)leftBound { return self.availableArea.origin.x + kLeftOffset; }
|
||||
#pragma mark - UITableViewDelegate
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
auto cell = [tableView cellForRowAtIndexPath:indexPath];
|
||||
if ([cell isKindOfClass:[MWMAdBanner class]])
|
||||
[static_cast<MWMAdBanner *>(cell) highlightButton];
|
||||
}
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
|
|
|
@ -290,7 +290,6 @@ CGFloat const kMinOffset = 1;
|
|||
auto cell = [tableView cellForRowAtIndexPath:indexPath];
|
||||
if ([cell isKindOfClass:[MWMAdBanner class]])
|
||||
{
|
||||
[static_cast<MWMAdBanner *>(cell) highlightButton];
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue