Files
peko-ios/YuMi/Modules/YMRoom/View/MenuContainerView/MSRoomMenuGameCell.m
edwinQQQ 99db078b62 feat(勋章): 新增多等级高亮功能并优化勋章展示逻辑
refactor(勋章排行): 重构排行榜分页加载和刷新逻辑

fix(会话): 优化官方账号判断逻辑和跳转处理

style(UI): 调整勋章排行榜和游戏菜单UI布局

chore: 更新Podfile配置和bitcode框架列表
2025-07-03 19:35:17 +08:00

87 lines
2.7 KiB
Objective-C

//
// MSRoomMenuGameCell.m
// YuMi
//
// Created by duoban on 2024/4/29.
//
#import "MSRoomMenuGameCell.h"
@interface MSRoomMenuGameCell()
@property(nonatomic,strong) NetImageView *gameView;
@property(nonatomic,strong) UILabel *textView;
@end
@implementation MSRoomMenuGameCell
-(instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if(self){
[self installUI];
[self installConstraints];
}
return self;
}
-(void)installUI{
[self.contentView addSubview:self.gameView];
[self.contentView addSubview:self.textView];
}
-(void)installConstraints{
[self.gameView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.leading.trailing.mas_equalTo(self.contentView).inset(4);
make.height.mas_equalTo(self.gameView.mas_width);
// make.centerX.equalTo(self.contentView);
}];
[self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.gameView.mas_bottom).mas_offset(7);
make.leading.trailing.equalTo(self.contentView).inset(kGetScaleWidth(5));
}];
}
- (void)setModel:(ActivityInfoModel *)model{
_model = model;
_gameView.image = nil;
@kWeakify(self);
[_gameView loadImageWithUrl:_model.icon completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) {
@kStrongify(self);
self.gameView.image = image;
}];
_textView.text = _model.name;
}
- (void)setMoreItemModel:(XPRoomMoreItemModel *)moreItemModel {
_moreItemModel = moreItemModel;
_gameView.image = [UIImage getLanguageImage:moreItemModel.imageName];
}
- (void)setLittleGameModel:(LittleGameInfoModel *)littleGameModel{
_littleGameModel = littleGameModel;
_gameView.image = nil;
@kWeakify(self);
[_gameView loadImageWithUrl:littleGameModel.pic2 completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) {
@kStrongify(self);
self.gameView.image = image;
}];
_textView.text = littleGameModel.name;
}
#pragma mark - 懒加载
- (NetImageView *)gameView{
if(!_gameView){
NetImageConfig *config = [NetImageConfig new];
config.placeHolder = [UIImageConstant defaultEmptyAvatarPlaceholder];
_gameView = [[NetImageView alloc]initWithConfig:config];
_gameView.contentMode = UIViewContentModeScaleToFill;
_gameView.layer.cornerRadius = kGetScaleWidth(6);
_gameView.layer.masksToBounds = YES;
}
return _gameView;
}
- (UILabel *)textView{
if(!_textView){
_textView = [UILabel labelInitWithText:@"" font:kFontRegular(12) textColor:[UIColor whiteColor]];
_textView.textAlignment = NSTextAlignmentCenter;
_textView.numberOfLines = 2;
_textView.hidden = NO;
}
return _textView;
}
@end