1
0
mirror of https://github.com/danog/Telegram.git synced 2025-01-22 05:52:06 +01:00
Telegram/Telegraph/TGWallpaperItemsBackgroundDecorationView.m
2014-07-10 18:11:09 +04:00

53 lines
1.5 KiB
Objective-C

#import "TGWallpaperItemsBackgroundDecorationView.h"
#import "TGImageUtils.h"
@interface TGWallpaperItemsBackgroundDecorationView ()
{
UIView *_topSeparatorView;
UIView *_bottomSeparatorView;
}
@end
@implementation TGWallpaperItemsBackgroundDecorationView
+ (NSString *)kind
{
return @"TGWallpaperItemsBackgroundDecorationView";
}
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self != nil)
{
self.backgroundColor = [UIColor whiteColor];
CGFloat separatorHeight = TGIsRetina() ? 0.5f : 1.0f;
_topSeparatorView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, frame.size.width, separatorHeight)];
_topSeparatorView.backgroundColor = TGSeparatorColor();
[self addSubview:_topSeparatorView];
_bottomSeparatorView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, frame.size.height - separatorHeight, frame.size.width, separatorHeight)];
_bottomSeparatorView.backgroundColor = TGSeparatorColor();
[self addSubview:_bottomSeparatorView];
}
return self;
}
- (void)layoutSubviews
{
[super layoutSubviews];
CGRect frame = self.frame;
CGFloat separatorHeight = TGIsRetina() ? 0.5f : 1.0f;
_topSeparatorView.frame = CGRectMake(0.0f, 0.0f, frame.size.width, separatorHeight);
_bottomSeparatorView.frame = CGRectMake(0.0f, frame.size.height - separatorHeight, frame.size.width, separatorHeight);
}
@end