// // XPMIneGameCollectionViewCell.m // xplan-ios // // Created by GreenLand on 2022/7/22. // #import "XPMIneGameCollectionViewCell.h" ///Third #import #import "NetImageView.h" ///Tool #import "ThemeColor.h" ///Model #import "LittleGameInfoModel.h" @interface XPMIneGameCollectionViewCell () ///显示图片 @property (nonatomic,strong) NetImageView *logoImageView; ///显示名字 @property (nonatomic,strong) UILabel *titleLabel; @end @implementation XPMIneGameCollectionViewCell - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { [self initSubViews]; [self initSubViewConstraints]; } return self; } #pragma mark - Private Method - (void)initSubViews { [self.contentView addSubview:self.logoImageView]; [self.contentView addSubview:self.titleLabel]; } - (void)initSubViewConstraints { [self.logoImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.size.mas_equalTo(CGSizeMake(40, 40)); make.centerX.top.mas_equalTo(self.contentView); }]; [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(self.logoImageView.mas_bottom).offset(6); make.centerX.mas_equalTo(self.contentView); }]; } #pragma mark - Getters And Setters - (void)setGameModel:(LittleGameInfoModel *)gameModel { _gameModel = gameModel; if (gameModel) { self.titleLabel.text = gameModel.name; self.logoImageView.imageUrl = gameModel.pic; } } - (NetImageView *)logoImageView { if (!_logoImageView) { _logoImageView = [[NetImageView alloc] init]; } return _logoImageView; } - (UILabel *)titleLabel { if (!_titleLabel) { _titleLabel = [[UILabel alloc] init]; _titleLabel.font = [UIFont systemFontOfSize:13]; _titleLabel.textAlignment = NSTextAlignmentCenter; _titleLabel.textColor = [ThemeColor secondTextColor]; } return _titleLabel; } @end