Add initWithCoder and move init code to common method

Signed-off-by: Marcel Müller <marcel-mueller@gmx.de>
This commit is contained in:
Marcel Müller 2023-01-05 09:58:55 +01:00
Родитель bc8d0b3e92
Коммит 19dbcaafc8
1 изменённых файлов: 28 добавлений и 12 удалений

Просмотреть файл

@ -37,23 +37,39 @@
self = [super init];
if (self) {
[[NSBundle mainBundle] loadNibNamed:@"NCChatTitleView" owner:self options:nil];
[self addSubview:self.contentView];
self.contentView.frame = self.bounds;
self.image.layer.cornerRadius = 15.0f;
self.image.clipsToBounds = YES;
self.image.backgroundColor = [NCAppBranding avatarPlaceholderColor];
self.title.titleLabel.adjustsFontSizeToFitWidth = YES;
self.title.titleLabel.minimumScaleFactor = 0.85;
[self.title setTitleColor:[NCAppBranding themeTextColor] forState:UIControlStateNormal];
[self.subtitle setTextColor:[[NCAppBranding themeTextColor] colorWithAlphaComponent:0.7]];
[self commonInit];
}
return self;
}
- (instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self) {
[self commonInit];
}
return self;
}
- (void)commonInit
{
[[NSBundle mainBundle] loadNibNamed:@"NCChatTitleView" owner:self options:nil];
[self addSubview:self.contentView];
self.contentView.frame = self.bounds;
self.image.layer.cornerRadius = 15.0f;
self.image.clipsToBounds = YES;
self.image.backgroundColor = [NCAppBranding avatarPlaceholderColor];
self.title.titleLabel.adjustsFontSizeToFitWidth = YES;
self.title.titleLabel.minimumScaleFactor = 0.85;
[self.title setTitleColor:[NCAppBranding themeTextColor] forState:UIControlStateNormal];
[self.subtitle setTextColor:[[NCAppBranding themeTextColor] colorWithAlphaComponent:0.7]];
}
- (void)setUserStatus:(NSString *)userStatus
{
UIImage *statusImage = nil;