feat: 基本完成首页 UI 调整
BIN
YuMi/Assets.xcassets/1.0.30/room_top_1.imageset/1@3x (1).png
vendored
Normal file
After Width: | Height: | Size: 69 KiB |
@@ -9,7 +9,7 @@
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "图层 2@3x.png",
|
||||
"filename" : "1@3x (1).png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
BIN
YuMi/Assets.xcassets/1.0.30/room_top_2.imageset/2@3x (1).png
vendored
Normal file
After Width: | Height: | Size: 62 KiB |
@@ -9,7 +9,7 @@
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "图层 1@3x.png",
|
||||
"filename" : "2@3x (1).png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
BIN
YuMi/Assets.xcassets/1.0.30/room_top_3.imageset/3@3x (1).png
vendored
Normal file
After Width: | Height: | Size: 41 KiB |
@@ -9,7 +9,7 @@
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "图层 2@3x (1).png",
|
||||
"filename" : "3@3x (1).png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
@@ -9,7 +9,7 @@
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "图层 1@3x (1).png",
|
||||
"filename" : "推荐@3x (1).png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
BIN
YuMi/Assets.xcassets/1.0.30/room_type_cs.imageset/推荐@3x (1).png
vendored
Normal file
After Width: | Height: | Size: 2.0 KiB |
21
YuMi/Assets.xcassets/1.0.30/room_type_rd.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "推荐@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
YuMi/Assets.xcassets/1.0.30/room_type_rd.imageset/推荐@3x.png
vendored
Normal file
After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 7.8 KiB |
BIN
YuMi/Assets.xcassets/Language/ar/room_top_1_ar.imageset/1@3x.png
vendored
Normal file
After Width: | Height: | Size: 70 KiB |
21
YuMi/Assets.xcassets/Language/ar/room_top_1_ar.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "1@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
YuMi/Assets.xcassets/Language/ar/room_top_2_ar.imageset/2@3x.png
vendored
Normal file
After Width: | Height: | Size: 62 KiB |
21
YuMi/Assets.xcassets/Language/ar/room_top_2_ar.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "2@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
YuMi/Assets.xcassets/Language/ar/room_top_3_ar.imageset/3@3x.png
vendored
Normal file
After Width: | Height: | Size: 41 KiB |
21
YuMi/Assets.xcassets/Language/ar/room_top_3_ar.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "3@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 8.4 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "home_hour_no_1@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "home_hour_no_1@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 10 KiB |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "home_week_no_1@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "home_week_no_1@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 9.9 KiB |
@@ -41,10 +41,11 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic, copy) NSString *broadMsg;
|
||||
///性别
|
||||
@property (nonatomic,assign) GenderType gender;
|
||||
//是否为小时榜top1
|
||||
@property(nonatomic,assign) BOOL isHourTop1;
|
||||
//是否为周榜top1
|
||||
@property(nonatomic,assign) BOOL isWeekTop1;
|
||||
|
||||
@property(nonatomic, assign) NSInteger hourTop;// 小时榜排名(0,1,2,3)
|
||||
@property(nonatomic, strong) NSNumber *hotValue; // 热度值
|
||||
@property(nonatomic, assign) NSInteger homeRoomType; //(0=null,1=热门,2=客服)
|
||||
|
||||
@property(nonatomic,copy) NSString *inRoomUid;
|
||||
//是否在麦位
|
||||
@property(nonatomic,assign) BOOL inMic;
|
||||
|
@@ -15,7 +15,7 @@
|
||||
///榜单
|
||||
@property(nonatomic,strong) NetImageView *rankImageView;
|
||||
///类型
|
||||
@property(nonatomic,strong) NetImageView *tagavatarView;
|
||||
@property(nonatomic,strong) NetImageView *tagImageView;
|
||||
|
||||
///房间名
|
||||
@property(nonatomic,strong) UILabel *nameLabel;
|
||||
@@ -39,6 +39,9 @@
|
||||
-(instancetype)initWithFrame:(CGRect)frame{
|
||||
self = [super initWithFrame:frame];
|
||||
if(self){
|
||||
self.clipsToBounds = NO;
|
||||
self.contentView.clipsToBounds = NO;
|
||||
|
||||
[self installUI];
|
||||
[self installConstraints];
|
||||
|
||||
@@ -66,11 +69,18 @@
|
||||
return self;
|
||||
}
|
||||
-(void)installUI{
|
||||
self.contentView.backgroundColor = [UIColor whiteColor];
|
||||
self.contentView.layer.cornerRadius = kGetScaleWidth(10);
|
||||
self.contentView.layer.masksToBounds = YES;
|
||||
self.contentView.backgroundColor = [UIColor clearColor];
|
||||
|
||||
UIView *bg = [[UIView alloc] init];
|
||||
bg.backgroundColor = [UIColor whiteColor];
|
||||
[bg setCornerRadius:10];
|
||||
[self.contentView addSubview:bg];
|
||||
[bg mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.contentView);
|
||||
}];
|
||||
|
||||
[self.contentView addSubview:self.avatarView];
|
||||
[self.contentView addSubview:self.tagavatarView];
|
||||
[self.contentView addSubview:self.tagImageView];
|
||||
[self.contentView addSubview:self.rankImageView];
|
||||
|
||||
[self.avatarView addSubview:self.pkImageView];
|
||||
@@ -94,20 +104,45 @@
|
||||
}
|
||||
-(void)installConstraints{
|
||||
[self.avatarView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(kGetScaleWidth(72));
|
||||
make.height.mas_equalTo(kGetScaleWidth(72));
|
||||
make.width.height.mas_equalTo(kGetScaleWidth(73));
|
||||
make.leading.mas_equalTo(kGetScaleWidth(10));
|
||||
make.top.mas_equalTo(kGetScaleWidth(10));
|
||||
make.bottom.mas_equalTo(-kGetScaleWidth(10));
|
||||
}];
|
||||
|
||||
[self.flagImage mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(self.avatarView.mas_trailing).offset(12);
|
||||
make.height.mas_equalTo(kGetScaleWidth(14));
|
||||
make.width.mas_equalTo(kGetScaleWidth(18));
|
||||
make.top.mas_equalTo(self.avatarView).offset(4);
|
||||
}];
|
||||
|
||||
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(self.flagImage.mas_trailing).offset(6);
|
||||
make.top.mas_equalTo(self.avatarView).offset(0);
|
||||
make.trailing.mas_equalTo(self).offset(-32);
|
||||
make.height.mas_equalTo(kGetScaleWidth(22));
|
||||
}];
|
||||
|
||||
[self.rankImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.contentView);
|
||||
make.edges.mas_equalTo(self.contentView).insets(UIEdgeInsetsMake(-20, -10, 0, -10));
|
||||
// make.center.mas_equalTo(self.contentView);
|
||||
// make.size.mas_equalTo(self.contentView).multipliedBy(1.1);
|
||||
}];
|
||||
[self.tagavatarView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.trailing.mas_equalTo(0);
|
||||
make.width.mas_equalTo(kGetScaleWidth(62));
|
||||
make.height.mas_equalTo(kGetScaleWidth(19));
|
||||
|
||||
[self.tagImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.flagImage.mas_bottom).offset(4);
|
||||
make.leading.mas_equalTo(self.flagImage);
|
||||
make.width.mas_equalTo(0);
|
||||
make.height.mas_equalTo(20);
|
||||
}];
|
||||
|
||||
[self.subLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.equalTo(self.tagImageView.mas_trailing);
|
||||
make.trailing.mas_equalTo(self).offset(-32);
|
||||
make.height.mas_equalTo(20);
|
||||
make.centerY.mas_equalTo(self.tagImageView);
|
||||
}];
|
||||
|
||||
[self.heatView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.trailing.mas_equalTo(-kGetScaleWidth(8));
|
||||
make.bottom.mas_equalTo(-kGetScaleWidth(10));
|
||||
@@ -120,75 +155,106 @@
|
||||
make.trailing.equalTo(self.heatView.mas_leading).mas_offset(-kGetScaleWidth(7));
|
||||
make.centerY.equalTo(self.heatView);
|
||||
}];
|
||||
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(kGetScaleWidth(90));
|
||||
make.top.mas_equalTo(kGetScaleWidth(10));
|
||||
make.trailing.equalTo(self.tagavatarView.mas_leading).mas_equalTo(5);
|
||||
make.height.mas_equalTo(kGetScaleWidth(22));
|
||||
}];
|
||||
|
||||
[self.flagImage mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.equalTo(self.nameLabel);
|
||||
make.height.mas_equalTo(kGetScaleWidth(14));
|
||||
make.width.mas_equalTo(kGetScaleWidth(18));
|
||||
make.top.equalTo(self.nameLabel.mas_bottom).mas_offset(kGetScaleWidth(6));
|
||||
}];
|
||||
|
||||
[self.subLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.equalTo(self.nameLabel).offset(kGetScaleWidth(18) + 4);
|
||||
make.trailing.equalTo(self.nameLabel);
|
||||
make.height.mas_equalTo(kGetScaleWidth(17));
|
||||
make.top.equalTo(self.nameLabel.mas_bottom).mas_offset(kGetScaleWidth(5));
|
||||
}];
|
||||
[self.pkImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(kGetScaleWidth(23));
|
||||
make.height.mas_equalTo(kGetScaleWidth(22));
|
||||
make.trailing.mas_equalTo(-kGetScaleWidth(6));
|
||||
make.bottom.equalTo(self.avatarView.mas_bottom).mas_offset(-kGetScaleWidth(6));
|
||||
}];
|
||||
|
||||
[self.boomImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.mas_equalTo(self.heatView.mas_top).offset(-6);
|
||||
make.trailing.mas_equalTo(self.contentView).offset(-8);
|
||||
make.size.mas_equalTo(CGSizeMake(40, 40));
|
||||
}];
|
||||
}
|
||||
- (void)setRoomInfo:(HomePlayRoomModel *)roomInfo{
|
||||
|
||||
_roomInfo = roomInfo;
|
||||
_nameLabel.text = _roomInfo.title;
|
||||
_avatarView.imageUrl = _roomInfo.avatar;
|
||||
|
||||
switch (roomInfo.homeRoomType) {
|
||||
case 1:{
|
||||
NSTextAttachment *attach = [[NSTextAttachment alloc] init];
|
||||
attach.image = kImage(@"room_type_rd");
|
||||
attach.bounds = CGRectMake(0, 2, 14, 14);
|
||||
NSAttributedString *attachString = [NSAttributedString attributedStringWithAttachment:attach];
|
||||
NSAttributedString *titleString = [[NSAttributedString alloc] initWithString:roomInfo.title
|
||||
attributes:@{
|
||||
NSFontAttributeName: kFontSemibold(15),
|
||||
NSForegroundColorAttributeName: UIColorFromRGB(0x313131)
|
||||
}];
|
||||
NSMutableAttributedString *ms = [[NSMutableAttributedString alloc] initWithAttributedString:titleString];
|
||||
[ms insertAttributedString:attachString atIndex:0];
|
||||
_nameLabel.attributedText = ms;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
NSTextAttachment *attach = [[NSTextAttachment alloc] init];
|
||||
attach.image = kImage(@"room_type_cs");
|
||||
attach.bounds = CGRectMake(0, 2, 14, 14);
|
||||
NSAttributedString *attachString = [NSAttributedString attributedStringWithAttachment:attach];
|
||||
NSAttributedString *titleString = [[NSAttributedString alloc] initWithString:roomInfo.title
|
||||
attributes:@{
|
||||
NSFontAttributeName: kFontSemibold(15),
|
||||
NSForegroundColorAttributeName: UIColorFromRGB(0x313131)
|
||||
}];
|
||||
NSMutableAttributedString *ms = [[NSMutableAttributedString alloc] initWithAttributedString:titleString];
|
||||
[ms insertAttributedString:attachString atIndex:0];
|
||||
_nameLabel.attributedText = ms;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
_nameLabel.text = _roomInfo.title;
|
||||
break;
|
||||
}
|
||||
|
||||
if (roomInfo.roomBoom) {
|
||||
self.boomImageView.hidden = NO;
|
||||
self.boomImageView.imageUrl = [roomInfo roomBoomPic];
|
||||
} else {
|
||||
self.boomImageView.hidden = YES;
|
||||
}
|
||||
|
||||
[self.subLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.trailing.mas_equalTo(self).offset(self.boomImageView.hidden ? -8 : -40);
|
||||
}];
|
||||
|
||||
if ([NSString isEmpty:roomInfo.tagPict]) {
|
||||
self.subLabel.text = _roomInfo.roomDesc.length > 0 ? _roomInfo.roomDesc : YMLocalizedString(@"XPHomeMineViewController3");
|
||||
} else {
|
||||
@kWeakify(self);
|
||||
[_tagavatarView loadImageWithUrl:_roomInfo.tagPict
|
||||
[_tagImageView loadImageWithUrl:_roomInfo.tagPict
|
||||
completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) {
|
||||
@kStrongify(self);
|
||||
self.tagavatarView.image = image;
|
||||
self.tagImageView.image = image;
|
||||
CGFloat width = kGetScaleWidth(62);
|
||||
if (image.size.height > 0){
|
||||
width = image.size.width * kGetScaleWidth(19) / image.size.height;
|
||||
}
|
||||
[self.tagavatarView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
[self.tagImageView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(width);
|
||||
}];
|
||||
|
||||
self.subLabel.text = [NSString stringWithFormat:@" %@", roomInfo.roomDesc.length > 0 ? roomInfo.roomDesc : YMLocalizedString(@"XPHomeMineViewController3")];
|
||||
}];
|
||||
}
|
||||
|
||||
[self.flagImage mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(roomInfo.regionFlag.length > 0 ? kGetScaleWidth(18) : 0);
|
||||
}];
|
||||
[self.subLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.equalTo(self.nameLabel).offset(roomInfo.regionFlag.length > 0 ? kGetScaleWidth(18)+4 : 0);
|
||||
[self.nameLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
if (roomInfo.regionFlag.length > 0) {
|
||||
make.leading.mas_equalTo(self.flagImage.mas_trailing).offset(8);
|
||||
} else {
|
||||
make.leading.mas_equalTo(self.flagImage);
|
||||
}
|
||||
}];
|
||||
self.flagImage.imageUrl = roomInfo.regionFlag;
|
||||
|
||||
_subLabel.text = _roomInfo.roomDesc.length > 0 ? _roomInfo.roomDesc : YMLocalizedString(@"XPHomeMineViewController3");
|
||||
_heatView.text = @(_roomInfo.onlineNum).stringValue;
|
||||
_heatView.text = roomInfo.hotValue.stringValue;
|
||||
_rankImageView.image = nil;
|
||||
_pkImageView.hidden = !_roomInfo.crossPking;
|
||||
if(_roomInfo.isHourTop1 == YES){
|
||||
_rankImageView.image = [UIImage getLanguageImage:@"home_hour_no_1"];
|
||||
}else{
|
||||
if(_roomInfo.isWeekTop1 == YES){
|
||||
_rankImageView.image = [UIImage getLanguageImage:@"home_week_no_1"];
|
||||
}
|
||||
if (roomInfo.hourTop > 0) {
|
||||
NSString *name = [NSString stringWithFormat:@"room_top_%ld", (long)roomInfo.hourTop];
|
||||
_rankImageView.image = [UIImage getLanguageImage:name];
|
||||
}
|
||||
|
||||
for (int i = 0; i < self.membersCount; i++) {
|
||||
@@ -205,12 +271,7 @@
|
||||
make.width.mas_equalTo(self.roomInfo.width);
|
||||
}];
|
||||
|
||||
if (roomInfo.roomBoom) {
|
||||
self.boomImageView.hidden = NO;
|
||||
self.boomImageView.imageUrl = [roomInfo roomBoomPic];
|
||||
} else {
|
||||
self.boomImageView.hidden = YES;
|
||||
}
|
||||
[self layoutIfNeeded];
|
||||
}
|
||||
#pragma mark - 懒加载
|
||||
- (NetImageView *)avatarView{
|
||||
@@ -229,11 +290,11 @@
|
||||
}
|
||||
return _rankImageView;
|
||||
}
|
||||
- (NetImageView *)tagavatarView{
|
||||
if(!_tagavatarView){
|
||||
_tagavatarView = [NetImageView new];
|
||||
- (NetImageView *)tagImageView{
|
||||
if(!_tagImageView){
|
||||
_tagImageView = [NetImageView new];
|
||||
}
|
||||
return _tagavatarView;
|
||||
return _tagImageView;
|
||||
}
|
||||
- (NetImageView *)boomImageView{
|
||||
if(!_boomImageView){
|
||||
|
@@ -213,7 +213,7 @@
|
||||
|
||||
id item = [self.datasource xpSafeObjectAtIndex:indexPath.row];
|
||||
if ([item isKindOfClass:[NSArray class]]) {
|
||||
return CGSizeMake(kGetScaleWidth(345), kGetScaleWidth(118));
|
||||
return CGSizeMake(kGetScaleWidth(345), kGetScaleWidth(105));
|
||||
} else {
|
||||
return CGSizeMake(kGetScaleWidth(345), kGetScaleWidth(92));
|
||||
}
|
||||
|