首页-为你推荐UI调整

This commit is contained in:
chenguilong
2022-09-23 17:00:35 +08:00
committed by fengshuo
parent ba27cf195d
commit c4f014d2fc
15 changed files with 379 additions and 155 deletions

View File

@@ -168,6 +168,7 @@
9B42869528C1E00A009034D2 /* XPRedPacketResultModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B42869428C1E00A009034D2 /* XPRedPacketResultModel.m */; };
9B42869828C1E06B009034D2 /* XPRedPacketModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B42869728C1E06B009034D2 /* XPRedPacketModel.m */; };
9B42869C28C1FD3D009034D2 /* XPOpenRedPacketCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B42869B28C1FD3D009034D2 /* XPOpenRedPacketCell.m */; };
9B46B91728DDA893000E30DB /* XPHomeRedommendCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B46B91628DDA893000E30DB /* XPHomeRedommendCollectionViewCell.m */; };
9B4769AD28DB270F00CCD312 /* XPHomePartyNavView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B4769AC28DB270F00CCD312 /* XPHomePartyNavView.m */; };
9B4D148127E485EB000AA0C1 /* XPRoomTrumpetView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B4D148027E485EB000AA0C1 /* XPRoomTrumpetView.m */; };
9B5BF8A827E1BED1005DD346 /* Api+RoomTrumpet.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B5BF8A727E1BED1005DD346 /* Api+RoomTrumpet.m */; };
@@ -1499,6 +1500,8 @@
9B42869728C1E06B009034D2 /* XPRedPacketModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRedPacketModel.m; sourceTree = "<group>"; };
9B42869A28C1FD3D009034D2 /* XPOpenRedPacketCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPOpenRedPacketCell.h; sourceTree = "<group>"; };
9B42869B28C1FD3D009034D2 /* XPOpenRedPacketCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPOpenRedPacketCell.m; sourceTree = "<group>"; };
9B46B91528DDA893000E30DB /* XPHomeRedommendCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeRedommendCollectionViewCell.h; sourceTree = "<group>"; };
9B46B91628DDA893000E30DB /* XPHomeRedommendCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPHomeRedommendCollectionViewCell.m; sourceTree = "<group>"; };
9B4769AB28DB270F00CCD312 /* XPHomePartyNavView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomePartyNavView.h; sourceTree = "<group>"; };
9B4769AC28DB270F00CCD312 /* XPHomePartyNavView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPHomePartyNavView.m; sourceTree = "<group>"; };
9B4D147F27E485EB000AA0C1 /* XPRoomTrumpetView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomTrumpetView.h; sourceTree = "<group>"; };
@@ -7834,6 +7837,8 @@
E8E5E19C27C36C3500F457D8 /* XPHomeMenuTableViewCell.m */,
E8E5E19527C36BE700F457D8 /* XPHomeRecommendTableViewCell.h */,
E8E5E19627C36BE700F457D8 /* XPHomeRecommendTableViewCell.m */,
9B46B91528DDA893000E30DB /* XPHomeRedommendCollectionViewCell.h */,
9B46B91628DDA893000E30DB /* XPHomeRedommendCollectionViewCell.m */,
E8E5E19827C36C0B00F457D8 /* XPHomeHotRoomTableViewCell.h */,
E8E5E19927C36C0B00F457D8 /* XPHomeHotRoomTableViewCell.m */,
E8E5E1A727C3850400F457D8 /* XPHomeHotRoomCollectionViewCell.h */,
@@ -9122,6 +9127,7 @@
9BE01AF02893E31700B50299 /* NewUserRechargeModel.m in Sources */,
E82325E6274CCAFA003A3332 /* XPShareInfoModel.m in Sources */,
9B32A04728881845002009D2 /* XPRoomTagListView.m in Sources */,
9B46B91728DDA893000E30DB /* XPHomeRedommendCollectionViewCell.m in Sources */,
189DD55A26DE39D200AB55B1 /* BaseMvpPresenter.m in Sources */,
E83ABEF9280EAF3F00322EE4 /* MessageContentOpenLiveView.m in Sources */,
E8F9168E27ECA69500F10D8F /* HomeLittleGameRoomModel.m in Sources */,

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "home_menu_friend@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "home_menu_friend@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "home_menu_game@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "home_menu_game@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "home_menu_live@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "home_menu_live@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -52,14 +52,16 @@
make.top.bottom.mas_equalTo(self.contentView);
}];
CGFloat width1 = (CGFloat)(KScreenWidth - 30 - 8) * 177 / (CGFloat)(176 + 85 + 83);
CGFloat width2 = (CGFloat)(KScreenWidth - 30 - 8) * 85 / (CGFloat)(176 + 85 + 83);
CGFloat width1 = ((KScreenWidth - 30 - 18) / 3);
[self.firstMenuView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(width1);
}];
[self.secondMenuView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(width2);
}];
[self.secondMenuView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(width1);
}];
[self.thirdMenuView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(width1);
}];
}
#pragma mark - Event Response
- (void)onTapMenuRecognizer:(UITapGestureRecognizer *)tap {
@@ -77,19 +79,14 @@
if (_menuList.count > 3) {
_menuList = [array subarrayWithRange:NSMakeRange(0, 3)];
}
for (int i = 0; i< _menuList.count; i++) {
NetImageView * imageView = [self.menuViewList objectAtIndex:i];
HomeMenuInfoModel * menuInfoModel = [_menuList objectAtIndex:i];
imageView.imageUrl = menuInfoModel.icon;
}
}
- (NetImageView *)firstMenuView {
if (!_firstMenuView) {
_firstMenuView = [[NetImageView alloc] init];
_firstMenuView.userInteractionEnabled = YES;
_firstMenuView.contentMode = UIViewContentModeScaleAspectFill;
_firstMenuView.contentMode = UIViewContentModeScaleAspectFit;
_firstMenuView.image = [UIImage imageNamed:@"home_menu_live"];
_firstMenuView.layer.masksToBounds = YES;
_firstMenuView.tag = 1000;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onTapMenuRecognizer:)];
@@ -102,8 +99,8 @@
if (!_secondMenuView) {
_secondMenuView = [[NetImageView alloc] init];
_secondMenuView.userInteractionEnabled = YES;
_secondMenuView.image = [UIImage imageNamed:@"home_recommend_icon"];
_secondMenuView.contentMode = UIViewContentModeScaleAspectFill;
_secondMenuView.image = [UIImage imageNamed:@"home_menu_friend"];
_secondMenuView.contentMode = UIViewContentModeScaleAspectFit;
_secondMenuView.layer.masksToBounds = YES;
_secondMenuView.tag = 1001;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onTapMenuRecognizer:)];
@@ -116,8 +113,8 @@
if (!_thirdMenuView) {
_thirdMenuView = [[NetImageView alloc] init];
_thirdMenuView.userInteractionEnabled = YES;
_thirdMenuView.image = [UIImage imageNamed:@"home_recommend_icon"];
_thirdMenuView.contentMode = UIViewContentModeScaleAspectFill;
_thirdMenuView.image = [UIImage imageNamed:@"home_menu_game"];
_thirdMenuView.contentMode = UIViewContentModeScaleAspectFit;
_thirdMenuView.layer.masksToBounds = YES;
_thirdMenuView.tag = 1002;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onTapMenuRecognizer:)];
@@ -132,7 +129,7 @@
_stackView.axis = UILayoutConstraintAxisHorizontal;
_stackView.distribution = UIStackViewDistributionFill;
_stackView.alignment = UIStackViewAlignmentFill;
_stackView.spacing = 4;
_stackView.spacing = 9;
}
return _stackView;
}

View File

@@ -11,23 +11,13 @@
///Tool
#import "XPMacro.h"
///View
#import "XPHomeRecommendListView.h"
#import "XPHomeRedommendCollectionViewCell.h"
@interface XPHomeRecommendTableViewCell ()
///
@property (nonatomic,strong) XPHomeRecommendListView *firstView;
///
@property (nonatomic,strong) XPHomeRecommendListView *secondView;
///
@property (nonatomic,strong) XPHomeRecommendListView *thirdView;
///
@property (nonatomic,strong) XPHomeRecommendListView *fourthView;
///
@property (nonatomic,strong) XPHomeRecommendListView *fiftView;
///
@property (nonatomic,strong) XPHomeRecommendListView *sixView;
@property (nonatomic,strong) NSArray<XPHomeRecommendListView *> *viewList;
@interface XPHomeRecommendTableViewCell ()<UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
@property (nonatomic, strong) UICollectionView *collectionView;
@end
@implementation XPHomeRecommendTableViewCell
@@ -44,54 +34,16 @@
- (void)initSubViews {
self.backgroundColor = [UIColor clearColor];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.firstView];
[self.contentView addSubview:self.secondView];
[self.contentView addSubview:self.thirdView];
[self.contentView addSubview:self.fourthView];
[self.contentView addSubview:self.fiftView];
[self.contentView addSubview:self.sixView];
self.viewList = @[self.firstView, self.secondView, self.thirdView,self.fourthView, self.fiftView, self.sixView];
[self.contentView addSubview:self.collectionView];
}
- (void)initSubViewConstraints {
CGFloat spaceWidth = 11 * kScreenScale;
CGFloat miniWidth = (KScreenWidth - 30 - spaceWidth * 2) / 3.0;
CGFloat bigWidth = miniWidth * 2 + spaceWidth;
[self.firstView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(bigWidth, bigWidth));
make.left.mas_equalTo(self.contentView).offset(15);
make.top.mas_equalTo(self.contentView);
}];
[self.secondView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(miniWidth, miniWidth));
make.left.mas_equalTo(self.firstView.mas_right).offset(spaceWidth);
make.top.mas_equalTo(self.contentView);
}];
[self.thirdView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.left.mas_equalTo(self.secondView);
make.top.mas_equalTo(self.secondView.mas_bottom).offset(spaceWidth);
}];
[self.fourthView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(self.secondView);
make.left.mas_equalTo(self.firstView);
make.top.mas_equalTo(self.firstView.mas_bottom).offset(spaceWidth);
}];
[self.fiftView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(self.secondView);
make.top.mas_equalTo(self.fourthView);
make.left.mas_equalTo(self.fourthView.mas_right).offset(spaceWidth);
}];
[self.sixView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(self.secondView);
make.left.mas_equalTo(self.fiftView.mas_right).offset(spaceWidth);
make.top.mas_equalTo(self.fourthView);
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.contentView).inset(15);
make.top.bottom.mas_equalTo(self.contentView);
}];
}
#pragma mark - Event Response
- (void)tapRecognizer:(UITapGestureRecognizer *)tap {
NSInteger index = tap.view.tag - 1001;
@@ -103,91 +55,56 @@
}
}
#pragma mark - UICollectionViewDelegate And UICollectionViewDatasource
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
return CGSizeMake(100 * kScreenScale, 100 * kScreenScale);
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return self.recommendList.count;
}
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
XPHomeRedommendCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPHomeRedommendCollectionViewCell class]) forIndexPath:indexPath];
HomeRecommendRoomModel * info = [self.recommendList objectAtIndex:indexPath.row];
cell.recommendRoomInfo = info;
return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
[collectionView deselectItemAtIndexPath:indexPath animated:YES];
if (self.recommendList.count > 0) {
HomeRecommendRoomModel * recommend = [self.recommendList objectAtIndex:indexPath.row];
if (self.delegate && [self.delegate respondsToSelector:@selector(xPHomeRecommendTableViewCell:didClickItem:)]) {
[self.delegate xPHomeRecommendTableViewCell:self didClickItem:recommend];
}
}
}
#pragma mark - Getters And Setters
- (void)setRecommendList:(NSArray *)recommendList {
_recommendList = recommendList;
if (_recommendList.count > 6) {
_recommendList = [_recommendList subarrayWithRange:NSMakeRange(0, 6)];
}
for (int i = 0; i < self.viewList.count; i++) {
XPHomeRecommendListView * recommendView = [self.viewList objectAtIndex:i];
if (i < _recommendList.count) {
HomeRecommendRoomModel * recommend = [_recommendList objectAtIndex:i];
recommendView.recommendRoomInfo = recommend;
} else {
recommendView.recommendRoomInfo = nil;
}
}
[self.collectionView reloadData];
}
- (XPHomeRecommendListView *)firstView {
if (!_firstView) {
_firstView = [[XPHomeRecommendListView alloc] init];
_firstView.isLarge = YES;
_firstView.tag = 1001;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapRecognizer:)];
[_firstView addGestureRecognizer:tap];
}
return _firstView;
- (UICollectionView *)collectionView{
if (!_collectionView) {
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
layout.minimumLineSpacing = 8 * kScreenScale;
layout.minimumInteritemSpacing = 0;
layout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
_collectionView.dataSource = self;
_collectionView.tag = 1001;
_collectionView.delegate = self;
_collectionView.backgroundColor = [UIColor clearColor];
_collectionView.showsHorizontalScrollIndicator = NO;
[_collectionView registerClass:[XPHomeRedommendCollectionViewCell class] forCellWithReuseIdentifier:NSStringFromClass([XPHomeRedommendCollectionViewCell class])];
}
return _collectionView;
}
- (XPHomeRecommendListView *)secondView {
if (!_secondView) {
_secondView = [[XPHomeRecommendListView alloc] init];
_secondView.isLarge = NO;
_secondView.tag = 1002;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapRecognizer:)];
[_secondView addGestureRecognizer:tap];
}
return _secondView;
}
- (XPHomeRecommendListView *)thirdView {
if (!_thirdView) {
_thirdView = [[XPHomeRecommendListView alloc] init];
_thirdView.isLarge = NO;
_thirdView.tag = 1003;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapRecognizer:)];
[_thirdView addGestureRecognizer:tap];
}
return _thirdView;
}
- (XPHomeRecommendListView *)fourthView {
if (!_fourthView) {
_fourthView = [[XPHomeRecommendListView alloc] init];
_fourthView.isLarge = NO;
_fourthView.tag = 1004;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapRecognizer:)];
[_fourthView addGestureRecognizer:tap];
}
return _fourthView;
}
- (XPHomeRecommendListView *)fiftView {
if (!_fiftView) {
_fiftView = [[XPHomeRecommendListView alloc] init];
_fiftView.isLarge = NO;
_fiftView.tag = 1005;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapRecognizer:)];
[_fiftView addGestureRecognizer:tap];
}
return _fiftView;
}
- (XPHomeRecommendListView *)sixView {
if (!_sixView) {
_sixView = [[XPHomeRecommendListView alloc] init];
_sixView.isLarge = NO;
_sixView.tag = 1006;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapRecognizer:)];
[_sixView addGestureRecognizer:tap];
}
return _sixView;
}
@end

View File

@@ -0,0 +1,19 @@
//
// XPHomeRedommendCollectionViewCell.h
// xplan-ios
//
// Created by GreenLand on 2022/9/23.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class HomeRecommendRoomModel;
@interface XPHomeRedommendCollectionViewCell : UICollectionViewCell
@property (nonatomic,strong, nullable) HomeRecommendRoomModel *recommendRoomInfo;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,219 @@
//
// XPHomeRedommendCollectionViewCell.m
// xplan-ios
//
// Created by GreenLand on 2022/9/23.
//
#import "XPHomeRedommendCollectionViewCell.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor+Home.h"
#import "NetImageView.h"
#import "UIImage+Utils.h"
///Model
#import "HomeRecommendRoomModel.h"
@interface XPHomeRedommendCollectionViewCell ()
///
@property (nonatomic,strong) UIView * backView;
///
@property (nonatomic,strong) NetImageView *avatarImageView;
///
@property (nonatomic,strong) UIView * personContainerView;
///🔥
@property (nonatomic,strong) UIImageView *hotImageView;
///线
@property (nonatomic,strong) UILabel *numberLabel;
///
@property (nonatomic,strong) UIImageView *shadowImageView;
///
@property (nonatomic,strong) UILabel *nickLabel;
///
@property (nonatomic,strong) UIButton *tagButton;
@end
@implementation XPHomeRedommendCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.backView];
[self.backView addSubview:self.avatarImageView];
[self.backView addSubview:self.shadowImageView];
[self.backView addSubview:self.personContainerView];
[self.backView addSubview:self.nickLabel];
[self.backView addSubview:self.tagButton];
[self.personContainerView addSubview:self.hotImageView];
[self.personContainerView addSubview:self.numberLabel];
}
- (void)initSubViewConstraints {
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self);
}];
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self);
}];
[self.hotImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(13, 13));
make.right.mas_equalTo(self.numberLabel.mas_left).offset(-2);
make.centerY.mas_equalTo(self.personContainerView);
}];
[self.numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.personContainerView.mas_right).offset(-4);
make.centerY.mas_equalTo(self.personContainerView);
}];
[self.shadowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.backView);
make.height.mas_equalTo(48);
make.bottom.mas_equalTo(self.backView);
}];
[self.tagButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.mas_equalTo(self.backView);
make.size.mas_equalTo(CGSizeMake(54, 20));
}];
[self.nickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.backView).offset(6);
make.right.mas_equalTo(self.backView).offset(-6);
make.centerY.mas_equalTo(self.shadowImageView);
}];
[self.personContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.hotImageView.mas_left).offset(-4);
make.height.mas_equalTo(16);
make.top.mas_equalTo(self.backView).offset(4);
make.right.mas_equalTo(self.backView).offset(-4);
}];
[self.shadowImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(28);
}];
}
#pragma mark - Getters And Setters
- (void)setRecommendRoomInfo:(HomeRecommendRoomModel *)recommendRoomInfo {
_recommendRoomInfo = recommendRoomInfo;
if (_recommendRoomInfo) {
self.avatarImageView.imageUrl = _recommendRoomInfo.avatar;
self.numberLabel.text = [NSString stringWithFormat:@"%ld", _recommendRoomInfo.onlineNum];
self.nickLabel.text = _recommendRoomInfo.title;
self.personContainerView.hidden = NO;
self.tagButton.hidden = NO;
if (_recommendRoomInfo.crossPking) {
[self.tagButton setTitle:@"PK中" forState:UIControlStateNormal];
} else {
if (_recommendRoomInfo.iconContent.length > 0) {
[self.tagButton setTitle:_recommendRoomInfo.iconContent forState:UIControlStateNormal];
} else {
self.tagButton.hidden = YES;
}
}
} else {
self.avatarImageView.image = [UIImage imageNamed:@"home_recommend_room_placeholder"];
self.nickLabel.text = @"虚位以待";
self.personContainerView.hidden = YES;
self.tagButton.hidden = YES;
}
}
- (UIView *)backView {
if (!_backView) {
_backView = [[UIView alloc] init];
_backView.backgroundColor = [UIColor clearColor];
_backView.layer.masksToBounds = YES;
_backView.layer.cornerRadius = 8;
_backView.layer.shadowColor = UIColorRGBAlpha(0xE5E5F2, 0.34).CGColor;
_backView.layer.shadowOffset = CGSizeMake(3, 3);
}
return _backView;
}
- (NetImageView *)avatarImageView {
if (!_avatarImageView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
_avatarImageView.layer.masksToBounds = YES;
_avatarImageView.layer.cornerRadius = 8;
}
return _avatarImageView;
}
- (UIButton *)tagButton {
if (!_tagButton) {
_tagButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_tagButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_tagButton.titleLabel.font = [UIFont systemFontOfSize:10];
[_tagButton setBackgroundImage:[UIImage imageNamed:@"home_recommend_tag_bg"] forState:UIControlStateNormal];
}
return _tagButton;
}
- (UIView *)personContainerView {
if (!_personContainerView) {
_personContainerView = [[UIView alloc] init];
_personContainerView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.29];
_personContainerView.layer.masksToBounds = YES;
_personContainerView.layer.cornerRadius = 8;
}
return _personContainerView;
}
- (UIImageView *)hotImageView {
if (!_hotImageView) {
_hotImageView = [[UIImageView alloc] init];
_hotImageView.userInteractionEnabled = YES;
_hotImageView.image = [UIImage imageNamed:@"room_like_collect_room_hot"];
}
return _hotImageView;
}
- (UILabel *)nickLabel {
if (!_nickLabel) {
_nickLabel = [[UILabel alloc] init];
_nickLabel.font = [UIFont boldSystemFontOfSize:12];
_nickLabel.textColor = [UIColor whiteColor];
_nickLabel.textAlignment = NSTextAlignmentCenter;
}
return _nickLabel;
}
- (UILabel *)numberLabel {
if (!_numberLabel) {
_numberLabel = [[UILabel alloc] init];
_numberLabel.font = [UIFont systemFontOfSize:9];
_numberLabel.textColor = [UIColor whiteColor];
}
return _numberLabel;
}
- (UIImageView *)shadowImageView {
if (!_shadowImageView) {
_shadowImageView = [[UIImageView alloc] init];
_shadowImageView.userInteractionEnabled = YES;
_shadowImageView.image = [UIImage imageNamed:@"home_recommend_nick_shadow_bg"];
}
return _shadowImageView;
}
@end

View File

@@ -32,8 +32,8 @@
#import "XPRoomViewController.h"
#define bannerHeight 140
#define menuHeight (KScreenWidth - 30 - 8) * 177 / (176 + 85 + 83) * ((CGFloat)60 / (CGFloat) 177)
#define recommendHeight (230 + 11 +108) * kScreenScale
#define menuHeight ((KScreenWidth - 30 - 18) / 3 * 74 / 111)
#define recommendHeight 100 * kScreenScale
#define hotRoomHeight 117 * kScreenScale
#define sectionHeight 50
UIKIT_EXTERN NSString * kHomeMoreScrollPageKey;