98 lines
2.8 KiB
Objective-C
98 lines
2.8 KiB
Objective-C
//
|
|
// XCGameRoomFaceCell.m
|
|
// XChat
|
|
//
|
|
// Created by 卫明何 on 2017/9/29.
|
|
// Copyright © 2017年 XC. All rights reserved.
|
|
//
|
|
|
|
#import "XCGameRoomFaceCell.h"
|
|
//third
|
|
#import <Masonry/Masonry.h>
|
|
//theme
|
|
#import "ThemeColor.h"
|
|
|
|
@implementation XCGameRoomFaceCell
|
|
|
|
- (instancetype)initWithFrame:(CGRect)frame {
|
|
if (self = [super initWithFrame:frame]) {
|
|
[self initView];
|
|
[self initConstrations];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void)initView {
|
|
[self.contentView addSubview:self.faceImageView];
|
|
[self.contentView addSubview:self.faceName];
|
|
[self.contentView addSubview:self.nobleTagImageView];
|
|
[self.contentView addSubview:self.lockImageView];
|
|
}
|
|
|
|
- (void)initConstrations {
|
|
[self.faceImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.mas_equalTo(self.contentView.mas_top);
|
|
make.width.height.mas_equalTo(36);
|
|
make.centerX.mas_equalTo(self.contentView.mas_centerX);
|
|
}];
|
|
[self.nobleTagImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.mas_equalTo(self.faceImageView.mas_top);
|
|
make.right.mas_equalTo(self.contentView);
|
|
make.width.mas_equalTo(20);
|
|
make.height.mas_equalTo(20);
|
|
}];
|
|
[self.faceName mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.mas_equalTo(self.faceImageView.mas_bottom);
|
|
make.centerX.mas_equalTo(self.faceImageView.mas_centerX);
|
|
}];
|
|
|
|
[self.lockImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.right.bottom.mas_equalTo(self.contentView).mas_offset(-4);
|
|
make.width.height.mas_equalTo(16);
|
|
}];
|
|
}
|
|
|
|
#pragma mark - setter & getter
|
|
|
|
- (UIImageView *)faceImageView {
|
|
if (!_faceImageView) {
|
|
_faceImageView = [[UIImageView alloc]init];
|
|
}
|
|
return _faceImageView;
|
|
}
|
|
|
|
- (UILabel *)faceName {
|
|
if (!_faceName) {
|
|
_faceName = [[UILabel alloc]init];
|
|
_faceName.font = [UIFont systemFontOfSize:12.f];
|
|
_faceName.textColor = UIColorFromRGB(0xd6d6d6);
|
|
_faceName.textAlignment = NSTextAlignmentCenter;
|
|
}
|
|
return _faceName;
|
|
}
|
|
|
|
- (NetImageView *)nobleTagImageView {
|
|
if (!_nobleTagImageView) {
|
|
_nobleTagImageView = [[NetImageView alloc] init];
|
|
_nobleTagImageView.contentMode = UIViewContentModeScaleAspectFit;
|
|
}
|
|
return _nobleTagImageView;
|
|
}
|
|
|
|
- (UIImageView *)lockImageView {
|
|
if (!_lockImageView) {
|
|
_lockImageView = [self createImageView:@"room_gift_noble_lock"];
|
|
_lockImageView.hidden = YES;
|
|
}
|
|
return _lockImageView;
|
|
}
|
|
|
|
- (UIImageView *)createImageView:(NSString *)imageName {
|
|
UIImageView * imageView = [[UIImageView alloc] init];
|
|
imageView.userInteractionEnabled = YES;
|
|
imageView.image = [UIImage imageNamed:imageName];
|
|
return imageView;
|
|
}
|
|
|
|
@end
|