1
0
mirror of https://github.com/danog/Telegram.git synced 2024-12-02 09:27:55 +01:00
Telegram/legacy/TelegraphKit/TGHighlightableButton.m
2015-10-01 19:19:52 +03:00

24 lines
824 B
Objective-C

#import "TGHighlightableButton.h"
@implementation TGHighlightableButton
- (void)setHighlighted:(BOOL)highlighted
{
for (UIView *view in self.subviews)
{
if ([view isKindOfClass:[UILabel class]])
[(UILabel *)view setHighlighted:highlighted];
else if ([view isKindOfClass:[UIImageView class]])
[(UIImageView *)view setHighlighted:highlighted];
}
if (_reverseTitleShadow)
self.titleLabel.shadowOffset = highlighted ? CGSizeMake(-_normalTitleShadowOffset.width, -_normalTitleShadowOffset.height) : _normalTitleShadowOffset;
if (_normalBackgroundColor != nil && _highlightedBackgroundColor != nil)
self.backgroundColor = highlighted ? _highlightedBackgroundColor : _normalBackgroundColor;
[super setHighlighted:highlighted];
}
@end