修复了消息中心UI显示不对的问题

This commit is contained in:
fengshuo
2022-12-26 19:06:04 +08:00
parent b798b89613
commit 67ce3f7329
2 changed files with 84 additions and 67 deletions

View File

@@ -11,14 +11,21 @@
#import "NetImageView.h"
#import "UIImage+Utils.h"
#import "XPSessionListFansPartyModel.h"
#import "XPNoteView.h"
@interface XPSessionListHeadFriendCell()
@property (nonatomic, strong) UILabel *nameLabel;
@property (nonatomic, strong) NetImageView *imageView;
@property (nonatomic, strong) UIImageView *dotView;
@property (nonatomic, strong) UIImageView *genderImageView;
///
@property (nonatomic, strong) UIImageView *noteBgImageView;
///
@property (nonatomic, strong) UILabel *liveLabel;
///
@property (nonatomic,strong) XPNoteView *noteImageView;
///
@property (nonatomic,strong) NSArray *animationArray;
@end
@implementation XPSessionListHeadFriendCell
@@ -32,21 +39,25 @@
}
- (void)initView {
[self addSubview:self.dotView];
[self addSubview:self.imageView];
[self addSubview:self.genderImageView];
[self addSubview:self.nameLabel];
[self.contentView addSubview:self.dotView];
[self.contentView addSubview:self.imageView];
[self.contentView addSubview:self.nameLabel];
[self.imageView addSubview:self.noteBgImageView];
[self.imageView addSubview:self.noteImageView];
[self.imageView addSubview:self.liveLabel];
}
- (void)initContraints {
[self.dotView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(12);
make.left.mas_equalTo(self);
make.width.height.mas_equalTo(48);
make.top.mas_equalTo(0);
make.centerX.mas_equalTo(self);
make.width.height.mas_equalTo(60);
}];
[self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.centerY.mas_equalTo(self.dotView);
make.width.height.mas_equalTo(44);
make.width.height.mas_equalTo(56);
}];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self);
@@ -54,9 +65,21 @@
make.height.mas_equalTo(17);
make.left.mas_equalTo(0);
}];
[self.genderImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.bottom.mas_equalTo(self.dotView);
make.width.height.mas_equalTo(14);
[self.noteBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.mas_equalTo(self.imageView);
make.height.mas_equalTo(14);
}];
[self.noteImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.noteBgImageView).mas_offset(15);
make.centerY.mas_equalTo(self.noteBgImageView).mas_offset(-1);
make.height.mas_equalTo(10);
make.width.mas_equalTo(10);
}];
[self.liveLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.noteImageView.mas_right).mas_offset(2);
make.centerY.mas_equalTo(self.noteImageView);
}];
}
@@ -64,7 +87,6 @@
self.imageView.imageUrl = data.avatar;
NSString *name = data.nick.length > 4 ? [data.nick substringToIndex:4] : data.nick;
self.nameLabel.text = name;
self.genderImageView.image = data.gender == 1 ? [UIImage imageNamed:@"common_male"] : [UIImage imageNamed:@"common_female"];
}
- (UILabel *)nameLabel {
@@ -83,7 +105,8 @@
NetImageConfig *config = [[NetImageConfig alloc] init];
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_imageView = [[NetImageView alloc] initWithConfig:config];
_imageView.layer.cornerRadius = 44/2;
_imageView.contentMode = UIViewContentModeScaleAspectFill;
_imageView.layer.cornerRadius = 54/2;
_imageView.layer.masksToBounds = YES;
_imageView.layer.borderWidth = 1;
_imageView.layer.borderColor = [UIColor whiteColor].CGColor;
@@ -94,18 +117,39 @@
- (UIImageView *)dotView {
if (!_dotView) {
_dotView = [[UIImageView alloc] init];
_dotView.layer.cornerRadius = 24.0;
_dotView.layer.cornerRadius = 60 / 2;
_dotView.layer.masksToBounds = YES;
_dotView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x5BC8F8), UIColorFromRGB(0x66D9D9)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(48, 48)];
_dotView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x5BC8F8), UIColorFromRGB(0x66D9D9)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(60, 60)];
}
return _dotView;
}
- (UIImageView *)genderImageView {
if (!_genderImageView) {
_genderImageView = [[UIImageView alloc] init];
- (UIImageView *)noteBgImageView {
if (!_noteBgImageView) {
_noteBgImageView = [[UIImageView alloc] init];
_noteBgImageView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFFA936), UIColorFromRGB(0xFFCB47)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(52, 14)];
}
return _genderImageView;
return _noteBgImageView;
}
- (UILabel *)liveLabel {
if (!_liveLabel) {
_liveLabel = [[UILabel alloc] init];
_liveLabel.font = [UIFont systemFontOfSize:8];
_liveLabel.textColor = [UIColor whiteColor];
_liveLabel.text = @"直播";
}
return _liveLabel;
}
- (XPNoteView *)noteImageView {
if (!_noteImageView) {
_noteImageView = [[XPNoteView alloc] init];
_noteImageView.pillarColor = [UIColor whiteColor];
_noteImageView.pillarWidth = 1.5;
[_noteImageView startAnimation];
}
return _noteImageView;
}
@end

View File

@@ -28,10 +28,6 @@ NSString * const kMengXinShowReadDotKey = @"kMengXinShowReadDotKey";
@property (nonatomic, strong) UIStackView *toolStackView;
///
@property (nonatomic, strong) UIView *friendContentView;
///view
@property (nonatomic, strong) UILabel *partyView;
///
@property (nonatomic,strong) UIImageView *fireImageView;
///
@property (nonatomic, strong) UICollectionView *collectionView;
@@ -75,7 +71,7 @@ NSString * const kMengXinShowReadDotKey = @"kMengXinShowReadDotKey";
- (void)initView {
[self addSubview:self.mainStackView];
[self.mainStackView addArrangedSubview:self.toolStackView];
[self.mainStackView addArrangedSubview:self.friendContentView];
[self.mainStackView addArrangedSubview:self.collectionView];
for (XPSessionListHeadItem *item in self.funtionArray) {
XPSessionListHeadItemView *itemView = [[XPSessionListHeadItemView alloc] init];
itemView.imageName = item.imageName;
@@ -86,33 +82,24 @@ NSString * const kMengXinShowReadDotKey = @"kMengXinShowReadDotKey";
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapItem:)];
[itemView addGestureRecognizer:tap];
}
[self.friendContentView addSubview:self.collectionView];
[self.friendContentView addSubview:self.partyView];
[self.friendContentView addSubview:self.fireImageView];
}
- (void)initContraints {
[self.mainStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(0);
}];
[self.partyView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(21);
make.top.mas_equalTo(12);
make.left.right.top.equalTo(self);
}];
[self.fireImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(15, 17));
make.centerY.mas_equalTo(self.partyView);
make.left.mas_equalTo(self.partyView.mas_right).offset(5);
[self.toolStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(75);
}];
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.right.mas_equalTo(-16);
make.height.mas_equalTo(90);
make.top.mas_equalTo(self.partyView.mas_bottom).mas_offset(-5);
make.bottom.mas_equalTo(0);
}];
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.mainStackView);
}];
}
@@ -130,7 +117,9 @@ NSString * const kMengXinShowReadDotKey = @"kMengXinShowReadDotKey";
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
XPSessionListFansPartyModel *model = [self.friendsArray safeObjectAtIndex1:indexPath.row];
[XPRoomViewController openRoom:model.uid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
if (model.roomUid.length > 0) {
[XPRoomViewController openRoom:model.roomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
}
}
- (void)updateToolViewWithUserLevel:(NSInteger)level {
@@ -220,6 +209,7 @@ NSString * const kMengXinShowReadDotKey = @"kMengXinShowReadDotKey";
_mainStackView.axis = UILayoutConstraintAxisVertical;
_mainStackView.distribution = UIStackViewDistributionFill;
_mainStackView.alignment = UIStackViewAlignmentFill;
_mainStackView.spacing = 15;
}
return _mainStackView;
}
@@ -230,6 +220,7 @@ NSString * const kMengXinShowReadDotKey = @"kMengXinShowReadDotKey";
_toolStackView.axis = UILayoutConstraintAxisHorizontal;
_toolStackView.distribution = UIStackViewDistributionFillEqually;
_toolStackView.alignment = UIStackViewAlignmentCenter;
_toolStackView.backgroundColor = [UIColor clearColor];
}
return _toolStackView;
}
@@ -254,7 +245,7 @@ NSString * const kMengXinShowReadDotKey = @"kMengXinShowReadDotKey";
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
layout.minimumLineSpacing = 18;
// layout.minimumInteritemSpacing = 18;
layout.itemSize = CGSizeMake(48, 90);
layout.itemSize = CGSizeMake(60, 90);
layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
[_collectionView registerClass:[XPSessionListHeadFriendCell class] forCellWithReuseIdentifier:NSStringFromClass([XPSessionListHeadFriendCell class])];
@@ -268,22 +259,4 @@ NSString * const kMengXinShowReadDotKey = @"kMengXinShowReadDotKey";
return _collectionView;
}
- (UILabel *)partyView {
if (!_partyView) {
_partyView = [[UILabel alloc] init];
_partyView.text = @"好友派对中";
_partyView.font = [UIFont systemFontOfSize:12];
_partyView.textColor = [ThemeColor mainTextColor];
}
return _partyView;
}
- (UIImageView *)fireImageView {
if (!_fireImageView) {
_fireImageView = [[UIImageView alloc] init];
_fireImageView.userInteractionEnabled = YES;
_fireImageView.image = [UIImage imageNamed:@"session_list_head_friend"];
}
return _fireImageView;
}
@end