新用户打招呼UI显示异常的问题

This commit is contained in:
fengshuo
2022-06-24 11:30:02 +08:00
parent 68f870979e
commit 6da2137259

View File

@@ -18,12 +18,6 @@
@property (nonatomic,strong) UIImageView *backImageView;
///
@property (nonatomic,strong) UIView * contentView;
///
@property (nonatomic,strong) NetImageView *firstAvatarView;
///
@property (nonatomic,strong) NetImageView *secondAvatarView;
///
@property (nonatomic,strong) NetImageView *thirdAvatarView;
///
@property (nonatomic,strong) UILabel *titleLabel;
///
@@ -49,13 +43,8 @@
[self addSubview:self.backImageView];
[self.backImageView addSubview:self.contentView];
[self.backImageView addSubview:self.closeButton];
[self.contentView addSubview:self.firstAvatarView];
[self.contentView addSubview:self.secondAvatarView];
[self.contentView addSubview:self.thirdAvatarView];
[self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.checkButton];
self.avatarViewList = @[self.firstAvatarView, self.secondAvatarView, self.thirdAvatarView];
}
- (void)initSubViewConstraints {
@@ -68,34 +57,17 @@
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.centerY.mas_equalTo(self.backImageView);
make.height.mas_equalTo(55);
make.left.mas_equalTo(self.thirdAvatarView.mas_left);
}];
[self.thirdAvatarView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.centerY.mas_equalTo(self.firstAvatarView);
make.right.mas_equalTo(self.secondAvatarView.mas_left).offset(6);
}];
[self.secondAvatarView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.centerY.mas_equalTo(self.firstAvatarView);
make.right.mas_equalTo(self.firstAvatarView.mas_left).offset(6);
}];
[self.firstAvatarView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(44, 44));
make.centerY.mas_equalTo(self.contentView);
make.right.mas_equalTo(self.titleLabel.mas_left).offset(-12);
make.left.mas_equalTo(self.titleLabel.mas_left).offset(-12);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.contentView);
make.top.mas_equalTo(self.firstAvatarView);
make.bottom.mas_equalTo(self.contentView.mas_centerY).offset(-3);
}];
[self.checkButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(80, 20));
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(8);
make.top.mas_equalTo(self.contentView.mas_centerY).offset(3);
make.centerX.mas_equalTo(self.titleLabel);
}];
@@ -133,7 +105,7 @@
- (void)setSayHelloUserAvatarList:(NSArray<NSString *> *)sayHelloUserAvatarList {
if (sayHelloUserAvatarList.count > 0) {
if (sayHelloUserAvatarList.count == 1) {
self.titleLabel.text = @"Ta向你发送了条消息~";
self.titleLabel.text = @"Ta向你发送了条消息~";
}else {
self.titleLabel.text = @"Ta们向你发送了多条消息~";
}
@@ -142,10 +114,28 @@
for (int i = 0; i < sayHelloUserAvatarList.count; i++) {
NSString * avatar = [sayHelloUserAvatarList objectAtIndex:i];
if (i < self.avatarViewList.count) {
NetImageView * image = [self.avatarViewList objectAtIndex:i];
image.imageUrl = avatar;
image.hidden = NO;
NetImageView * avatarImageView = [[NetImageView alloc] init];
NetImageConfig * config = [[NetImageConfig alloc]init];
config.imageType = ImageTypeUserIcon;
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
avatarImageView = [[NetImageView alloc] initWithConfig:config];
avatarImageView.layer.masksToBounds = YES;
avatarImageView.layer.cornerRadius = 44/2;
avatarImageView.layer.borderColor = [UIColor whiteColor].CGColor;
avatarImageView.layer.borderWidth = 1;
avatarImageView.imageUrl = avatar;
[self.contentView addSubview:avatarImageView];
[self.contentView sendSubviewToBack:avatarImageView];
[avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(44, 44));
make.right.mas_equalTo(self.titleLabel.mas_left).offset(-12 - 44 * i + 12 * i);
make.centerY.mas_equalTo(self.contentView);
}];
if (i == (sayHelloUserAvatarList.count -1)) {
[self.contentView mas_updateConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.titleLabel.mas_left).offset(-12 - 44 * (i + 1) + 12 * (i + 1));
}];
}
}
}
@@ -167,53 +157,6 @@
return _backImageView;
}
- (NetImageView *)firstAvatarView {
if (!_firstAvatarView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.imageType = ImageTypeUserIcon;
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_firstAvatarView = [[NetImageView alloc] initWithConfig:config];
_firstAvatarView.layer.masksToBounds = YES;
_firstAvatarView.layer.cornerRadius = 44/2;
_firstAvatarView.layer.borderColor = [UIColor whiteColor].CGColor;
_firstAvatarView.layer.borderWidth = 1;
_firstAvatarView.hidden = YES;
}
return _firstAvatarView;
}
- (NetImageView *)secondAvatarView {
if (!_secondAvatarView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.imageType = ImageTypeUserIcon;
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_secondAvatarView = [[NetImageView alloc] initWithConfig:config];
_secondAvatarView.layer.masksToBounds = YES;
_secondAvatarView.layer.cornerRadius = 44/2;
_secondAvatarView.layer.borderColor = [UIColor whiteColor].CGColor;
_secondAvatarView.layer.borderWidth = 1;
_secondAvatarView.hidden = YES;
}
return _secondAvatarView;
}
- (NetImageView *)thirdAvatarView {
if (!_thirdAvatarView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.imageType = ImageTypeUserIcon;
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_thirdAvatarView = [[NetImageView alloc] initWithConfig:config];
_thirdAvatarView.layer.masksToBounds = YES;
_thirdAvatarView.layer.cornerRadius = 44/2;
_thirdAvatarView.layer.borderColor = [UIColor whiteColor].CGColor;
_thirdAvatarView.layer.borderWidth = 1;
_thirdAvatarView.hidden = YES;
}
return _thirdAvatarView;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];