麦位显示上的优化

This commit is contained in:
zu
2021-11-05 16:08:44 +08:00
parent a92cea0cfc
commit e767258438
2 changed files with 14 additions and 3 deletions

View File

@@ -97,11 +97,19 @@
- (void)configMicroState:(MicroStateModel *)micState { - (void)configMicroState:(MicroStateModel *)micState {
self.micStateImageView.hidden = micState.micState == MicroMicStateType_Open; self.micStateImageView.hidden = micState.micState == MicroMicStateType_Open;
UIImage *image;
if (micState.posState == MicroPosStateType_Free) { if (micState.posState == MicroPosStateType_Free) {
self.avatarImageView.image = [UIImage imageNamed:@"room_position_normal"]; image = [UIImage imageNamed:@"room_position_normal"];
} else { } else {
self.avatarImageView.image = [UIImage imageNamed:@"room_position_lock"]; image = [UIImage imageNamed:@"room_position_lock"];
} }
CGSize scaledToSize = CGSizeMake(self.frame.size.width, self.frame.size.width);
UIGraphicsBeginImageContextWithOptions(scaledToSize, false, 0.0);
// 1
[image drawInRect:CGRectMake(1, 1, scaledToSize.width - 2, scaledToSize.height - 2)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
self.avatarImageView.backgroundColor = [UIColor colorWithPatternImage:newImage];
self.postionLabel.text = [NSString stringWithFormat:@"%d", micState.position + 1]; self.postionLabel.text = [NSString stringWithFormat:@"%d", micState.position + 1];
} }
@@ -118,6 +126,7 @@
self.nickLabel.text = userInfo.nick; self.nickLabel.text = userInfo.nick;
} }
} else { } else {
self.avatarImageView.image = nil;
[self.postionLabel setBackgroundColor:[ThemeColor positionNormalNickBackColor]]; [self.postionLabel setBackgroundColor:[ThemeColor positionNormalNickBackColor]];
} }
} }
@@ -127,7 +136,6 @@
if (!_avatarImageView) { if (!_avatarImageView) {
_avatarImageView = [[NetImageView alloc] init]; _avatarImageView = [[NetImageView alloc] init];
_avatarImageView.userInteractionEnabled = YES; _avatarImageView.userInteractionEnabled = YES;
_avatarImageView.image = [UIImage imageNamed:@"room_position_normal"];
} }
return _avatarImageView; return _avatarImageView;
} }

View File

@@ -42,12 +42,14 @@
return; return;
} }
self.isAnimationing = YES; self.isAnimationing = YES;
self.firstView.hidden = NO;
[self animationWithLayer:self.firstView]; [self animationWithLayer:self.firstView];
} }
/// ///
- (void)stopWaveAnimation { - (void)stopWaveAnimation {
self.isAnimationing = NO; self.isAnimationing = NO;
self.firstView.hidden = YES;
[self.firstView.layer removeAllAnimations]; [self.firstView.layer removeAllAnimations];
} }
@@ -55,6 +57,7 @@
#pragma mark - Private Method #pragma mark - Private Method
- (void)initSubViews { - (void)initSubViews {
[self addSubview:self.firstView]; [self addSubview:self.firstView];
self.firstView.hidden = YES;
} }