293 lines
9.5 KiB
Objective-C
293 lines
9.5 KiB
Objective-C
//
|
|
// XPNewHomePartyTableViewCell.m
|
|
// YuMi
|
|
//
|
|
// Created by YuMi on 2022/10/8.
|
|
//
|
|
|
|
#import "XPNewHomePartyTableViewCell.h"
|
|
///Third
|
|
#import <Masonry/Masonry.h>
|
|
///Tool
|
|
#import "DJDKMIMOMColor.h"
|
|
#import "NetImageView.h"
|
|
///Model
|
|
#import "HomePlayRoomModel.h"
|
|
#import "HomeRecommendRoomModel.h"
|
|
|
|
#import "XPNewHomePartyTagView.h"
|
|
#import "XPNewHomePartyAudioView.h"
|
|
|
|
|
|
@interface XPNewHomePartyTableViewCell ()
|
|
///容器
|
|
@property(nonatomic,strong) UIStackView *stackView;
|
|
///头像
|
|
@property (nonatomic,strong) NetImageView *avatarImageView;
|
|
///背景
|
|
@property (nonatomic,strong) UIView *bgView;
|
|
///房间标题
|
|
@property (nonatomic,strong) UILabel *titleLabel;
|
|
///标签
|
|
@property(nonatomic,strong) XPNewHomePartyTagView *tagView;
|
|
///小绿点
|
|
@property(nonatomic,strong) UIView *greenView;
|
|
///边框
|
|
@property (nonatomic,strong) UIImageView *borderImageView;
|
|
///游戏背景
|
|
@property(nonatomic,strong) UIImageView *gameBgView;
|
|
///游戏图标
|
|
@property(nonatomic,strong) UIImageView *gameIconView;
|
|
///声音、签名
|
|
@property(nonatomic,strong) XPNewHomePartyAudioView *audioView;
|
|
///聊天
|
|
@property(nonatomic,strong) UIButton *chatBtn;
|
|
///生日
|
|
@property(nonatomic,strong) UIButton *birthdayView;
|
|
///财富
|
|
@property(nonatomic,strong) NetImageView *wealthView;
|
|
///魅力
|
|
@property(nonatomic,strong) NetImageView *charmView;
|
|
@end
|
|
|
|
@implementation XPNewHomePartyTableViewCell
|
|
|
|
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
|
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
|
[self initSubViews];
|
|
[self initSubViewConstraints];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
#pragma mark - Private Method
|
|
- (void)initSubViews {
|
|
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
|
self.backgroundColor = [UIColor clearColor];
|
|
[self.contentView addSubview:self.bgView];
|
|
[self.bgView addSubview:self.borderImageView];
|
|
[self.bgView addSubview:self.avatarImageView];
|
|
[self.bgView addSubview:self.gameBgView];
|
|
[self.bgView addSubview:self.gameIconView];
|
|
[self.bgView addSubview:self.greenView];
|
|
[self.bgView addSubview:self.stackView];
|
|
|
|
|
|
|
|
[self.bgView addSubview:self.tagView];
|
|
[self.bgView addSubview:self.audioView];
|
|
[self.bgView addSubview:self.chatBtn];
|
|
|
|
|
|
|
|
|
|
[self.stackView addArrangedSubview:self.titleLabel];
|
|
[self.stackView addArrangedSubview:self.birthdayView];
|
|
[self.stackView addArrangedSubview:self.wealthView];
|
|
[self.stackView addArrangedSubview:self.charmView];
|
|
|
|
|
|
}
|
|
|
|
- (void)initSubViewConstraints {
|
|
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.mas_equalTo(kGetScaleWidth(0));
|
|
make.width.mas_equalTo(kGetScaleWidth(351));
|
|
make.height.mas_equalTo(kGetScaleWidth(96));
|
|
make.centerX.equalTo(self.contentView);
|
|
}];
|
|
|
|
[self.borderImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.leading.mas_equalTo(kGetScaleWidth(10));
|
|
make.width.height.mas_equalTo(kGetScaleWidth(68));
|
|
make.top.mas_equalTo(kGetScaleWidth(14));
|
|
}];
|
|
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.size.mas_equalTo(CGSizeMake(kGetScaleWidth(60), kGetScaleWidth(60)));
|
|
make.center.equalTo(self.borderImageView);
|
|
}];
|
|
|
|
[self.greenView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.width.height.mas_equalTo(kGetScaleWidth(10));
|
|
make.leading.mas_equalTo(kGetScaleWidth(60));
|
|
make.top.mas_equalTo(kGetScaleWidth(64));
|
|
}];
|
|
[self.greenView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.mas_equalTo(kGetScaleWidth(48));
|
|
make.leading.mas_equalTo(kGetScaleWidth(14));
|
|
make.width.mas_equalTo(kGetScaleWidth(60));
|
|
make.height.mas_equalTo(kGetScaleWidth(30));
|
|
}];
|
|
[self.gameIconView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.mas_equalTo(kGetScaleWidth(57));
|
|
make.leading.mas_equalTo(kGetScaleWidth(26));
|
|
make.width.mas_equalTo(kGetScaleWidth(37));
|
|
make.height.mas_equalTo(kGetScaleWidth(17));
|
|
}];
|
|
|
|
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.leading.mas_equalTo(kGetScaleWidth(84));
|
|
make.top.mas_equalTo(kGetScaleWidth(10));
|
|
make.trailing.mas_equalTo(-kGetScaleWidth(10));
|
|
}];
|
|
[self.birthdayView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.width.mas_equalTo(kGetScaleWidth(28));
|
|
make.height.mas_equalTo(kGetScaleWidth(14));
|
|
}];
|
|
[self.wealthView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.width.height.mas_equalTo(kGetScaleWidth(36));
|
|
make.height.mas_equalTo(kGetScaleWidth(18));
|
|
}];
|
|
[self.charmView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.width.height.mas_equalTo(kGetScaleWidth(36));
|
|
make.height.mas_equalTo(kGetScaleWidth(18));
|
|
}];
|
|
[self.chatBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.mas_equalTo(kGetScaleWidth(34));
|
|
make.trailing.mas_equalTo(-kGetScaleWidth(10));
|
|
make.height.mas_equalTo(kGetScaleWidth(28));
|
|
make.width.mas_equalTo(kGetScaleWidth(60));
|
|
}];
|
|
[self.tagView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.leading.mas_equalTo(kGetScaleWidth(84));
|
|
make.top.mas_equalTo(kGetScaleWidth(34));
|
|
make.height.mas_equalTo(kGetScaleWidth(18));
|
|
make.trailing.equalTo(self.chatBtn.mas_leading).mas_offset(-kGetScaleWidth(5));
|
|
}];
|
|
}
|
|
|
|
#pragma mark - Getters And Setters
|
|
- (void)setRoomInfo:(HomePlayRoomModel *)roomInfo {
|
|
_roomInfo = roomInfo;
|
|
if (_roomInfo) {
|
|
|
|
}
|
|
}
|
|
|
|
- (void)setRoomInfo1:(HomeRecommendRoomModel *)roomInfo1 {
|
|
_roomInfo1 = roomInfo1;
|
|
if (_roomInfo1) {
|
|
|
|
self.avatarImageView.imageUrl = _roomInfo1.avatar;
|
|
self.titleLabel.text = _roomInfo1.title;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- (NetImageView *)avatarImageView {
|
|
if (!_avatarImageView) {
|
|
NetImageConfig * config = [[NetImageConfig alloc]init];
|
|
config.imageType = ImageTypeUserIcon;
|
|
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
|
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
|
|
_avatarImageView.layer.masksToBounds = YES;
|
|
_avatarImageView.layer.cornerRadius = 74/2;
|
|
}
|
|
return _avatarImageView;
|
|
}
|
|
|
|
- (UIView *)bgView {
|
|
if (!_bgView) {
|
|
_bgView = [[UIView alloc] init];
|
|
_bgView.backgroundColor = [UIColor whiteColor];
|
|
_bgView.layer.masksToBounds = YES;
|
|
_bgView.layer.cornerRadius = kGetScaleWidth(12);
|
|
}
|
|
return _bgView;
|
|
}
|
|
|
|
- (UILabel *)titleLabel {
|
|
if (!_titleLabel) {
|
|
_titleLabel = [[UILabel alloc] init];
|
|
_titleLabel.font = [UIFont systemFontOfSize:15];
|
|
_titleLabel.textColor = [DJDKMIMOMColor mainTextColor];
|
|
}
|
|
return _titleLabel;
|
|
}
|
|
|
|
- (UIImageView *)borderImageView {
|
|
if (!_borderImageView) {
|
|
_borderImageView = [[UIImageView alloc] init];
|
|
_borderImageView.userInteractionEnabled = YES;
|
|
_borderImageView.layer.cornerRadius = kGetScaleWidth(68)/2;
|
|
_borderImageView.layer.masksToBounds = YES;
|
|
_borderImageView.layer.borderWidth = kGetScaleWidth(2);
|
|
_borderImageView.layer.borderColor = UIColorFromRGB(0xA974FF).CGColor;
|
|
}
|
|
return _borderImageView;
|
|
}
|
|
- (UIView *)greenView{
|
|
if(!_greenView){
|
|
_greenView = [UIView new];
|
|
_greenView.backgroundColor = UIColorFromRGB(0x3FE05F);
|
|
_greenView.layer.cornerRadius = kGetScaleWidth(10)/2;
|
|
_greenView.layer.masksToBounds = YES;
|
|
_greenView.layer.borderWidth = 1;
|
|
_greenView.layer.borderColor = [UIColor whiteColor].CGColor;
|
|
}
|
|
return _greenView;
|
|
}
|
|
- (UIImageView *)gameBgView{
|
|
if(!_gameBgView){
|
|
_gameBgView = [UIImageView new];
|
|
_gameBgView.image = kImage(@"home_palying_bg");
|
|
}
|
|
return _gameBgView;
|
|
}
|
|
- (UIImageView *)gameIconView{
|
|
if(!_gameIconView){
|
|
_gameIconView = [UIImageView new];
|
|
_gameIconView.image = kImage(@"home_palying_icon");
|
|
}
|
|
return _gameIconView;
|
|
}
|
|
- (UIButton *)chatBtn{
|
|
if(!_chatBtn){
|
|
_chatBtn = [UIButton new];
|
|
_chatBtn.backgroundColor = UIColorFromRGB(0x9168FA);
|
|
[_chatBtn setTitle:YMLocalizedString(@"XPSessionSayHelloTableViewCell0") forState:UIControlStateNormal];
|
|
_chatBtn.titleLabel.font = kFontMedium(12);
|
|
[_chatBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
|
_chatBtn.layer.cornerRadius = kGetScaleWidth(28)/2;
|
|
_chatBtn.layer.masksToBounds = YES;
|
|
}
|
|
return _chatBtn;
|
|
}
|
|
- (UIStackView *)stackView {
|
|
if (!_stackView) {
|
|
_stackView = [[UIStackView alloc] init];
|
|
_stackView.axis = UILayoutConstraintAxisHorizontal;
|
|
_stackView.distribution = UIStackViewDistributionFill;
|
|
_stackView.alignment = UIStackViewAlignmentFill;
|
|
_stackView.spacing = kGetScaleWidth(4);
|
|
}
|
|
return _stackView;
|
|
}
|
|
- (UIButton *)birthdayView{
|
|
if(!_birthdayView){
|
|
_birthdayView = [UIButton new];
|
|
[_birthdayView setImage:kImage(@"home_age_boy_icon") forState:UIControlStateNormal];
|
|
[_birthdayView setImage:kImage(@"home_age_girl_icon") forState:UIControlStateSelected];
|
|
_birthdayView.titleLabel.font = kFontMedium(10);
|
|
[_birthdayView setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
|
_birthdayView.imageEdgeInsets = UIEdgeInsetsMake(0, kGetScaleWidth(10), 0, 0);
|
|
}
|
|
return _birthdayView;
|
|
}
|
|
- (NetImageView *)wealthView{
|
|
if(!_wealthView){
|
|
_wealthView = [[NetImageView alloc]init];
|
|
}
|
|
return _wealthView;
|
|
}
|
|
- (NetImageView *)charmView{
|
|
if(!_charmView){
|
|
_charmView = [[NetImageView alloc]init];
|
|
}
|
|
return _charmView;
|
|
}
|
|
@end
|