76 lines
1.9 KiB
Mathematica
76 lines
1.9 KiB
Mathematica
![]() |
//
|
||
|
// XPCreateLittleGameCollectionViewCell.m
|
||
|
// xplan-ios
|
||
|
//
|
||
|
// Created by 冯硕 on 2022/1/21.
|
||
|
//
|
||
|
|
||
|
#import "XPCreateLittleGameCollectionViewCell.h"
|
||
|
///Third
|
||
|
#import <Masonry/Masonry.h>
|
||
|
#import "NetImageView.h"
|
||
|
#import "ThemeColor.h"
|
||
|
///Model
|
||
|
#import "LittleGameInfoModel.h"
|
||
|
|
||
|
@interface XPCreateLittleGameCollectionViewCell ()
|
||
|
///显示图片
|
||
|
@property (nonatomic, strong) NetImageView *logoImageView;
|
||
|
@end
|
||
|
|
||
|
|
||
|
@implementation XPCreateLittleGameCollectionViewCell
|
||
|
|
||
|
-(instancetype)initWithFrame:(CGRect)frame {
|
||
|
self = [super initWithFrame:frame];
|
||
|
if (self) {
|
||
|
[self initSubViews];
|
||
|
[self initSubViewConstraints];
|
||
|
}
|
||
|
return self;
|
||
|
}
|
||
|
|
||
|
- (void)initSubViews {
|
||
|
[self.contentView addSubview:self.logoImageView];
|
||
|
self.backgroundColor = [UIColor clearColor];
|
||
|
}
|
||
|
|
||
|
- (void)initSubViewConstraints {
|
||
|
[self.logoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.centerX.centerY.mas_equalTo(self);
|
||
|
make.size.mas_equalTo(CGSizeMake(90, 110));
|
||
|
}];
|
||
|
}
|
||
|
|
||
|
- (void)initViews {
|
||
|
[self.contentView addSubview:self.logoImageView];
|
||
|
self.backgroundColor = [UIColor clearColor];
|
||
|
}
|
||
|
- (void)setGameInfo:(LittleGameInfoModel *)gameInfo{
|
||
|
if (gameInfo) {
|
||
|
self.logoImageView.imageUrl = gameInfo.pic;
|
||
|
if (gameInfo.isSelect) {
|
||
|
self.logoImageView.layer.borderWidth = 2;
|
||
|
self.logoImageView.layer.borderColor = [ThemeColor appMainColor].CGColor;
|
||
|
} else {
|
||
|
self.logoImageView.layer.borderWidth = 0;
|
||
|
self.logoImageView.layer.borderColor = [UIColor clearColor].CGColor;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#pragma mark - Getter && Setter
|
||
|
- (NetImageView *)logoImageView {
|
||
|
if (!_logoImageView) {
|
||
|
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||
|
config.imageType = ImageTypeUserIcon;
|
||
|
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||
|
_logoImageView = [[NetImageView alloc] initWithConfig:config];
|
||
|
_logoImageView.layer.masksToBounds = YES;
|
||
|
_logoImageView.layer.cornerRadius = 12;
|
||
|
}
|
||
|
return _logoImageView;
|
||
|
}
|
||
|
|
||
|
@end
|