Swiftgram/submodules/LegacyComponents/LegacyComponents/TGPhotoStickersSectionHeaderView.m
Peter d153fe0f21 Add 'submodules/LegacyComponents/' from commit 'd5594346161c1b7f203d1e87068bbe77bcaac019'
git-subtree-dir: submodules/LegacyComponents
git-subtree-mainline: 608630530451e02e5aec48389d144dbf7a3625b9
git-subtree-split: d5594346161c1b7f203d1e87068bbe77bcaac019
2019-06-11 18:51:15 +01:00

54 lines
1.2 KiB
Objective-C

#import "TGPhotoStickersSectionHeaderView.h"
#import "LegacyComponentsInternal.h"
#import "TGFont.h"
#import "TGImageUtils.h"
const CGFloat TGPhotoStickersSectionHeaderHeight = 56.0f;
@interface TGPhotoStickersSectionHeaderView ()
{
UILabel *_titleLabel;
}
@end
@implementation TGPhotoStickersSectionHeaderView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self != nil)
{
self.backgroundColor = [UIColor clearColor];
_titleLabel = [[UILabel alloc] init];
_titleLabel.backgroundColor = [UIColor clearColor];
_titleLabel.textColor = UIColorRGB(0xafb2b1);
_titleLabel.font = TGSystemFontOfSize(17.0f);
[self addSubview:_titleLabel];
}
return self;
}
- (void)setTitle:(NSString *)title
{
_titleLabel.text = title;
[_titleLabel sizeToFit];
[self setNeedsLayout];
}
- (void)setTextColor:(UIColor *)color
{
_titleLabel.textColor = color;
}
- (void)layoutSubviews
{
[super layoutSubviews];
_titleLabel.frame = (CGRect){{16.0f, TGRetinaFloor((self.bounds.size.height - _titleLabel.frame.size.height) / 2.0f) + 5.0f}, { _titleLabel.frame.size.width, _titleLabel.frame.size.height }};
}
@end