Commit 1961242d by suolong

修复些ui bug

parent 2e3afab2
#import "FUSLiveGiftInteractAudiencePanelView.h" #import "FUSLiveGiftInteractAudiencePanelView.h"
#import "FUSLiveGiftInteractSettingItemModel.h" #import "FUSLiveGiftInteractSettingItemModel.h"
#import "CBAutoScrollLabel.h"
@interface FUSLiveGiftInteractAudiencePanelView () @interface FUSLiveGiftInteractAudiencePanelView ()
/// 顶部标题栏容器 /// 顶部标题栏容器
...@@ -15,7 +16,7 @@ ...@@ -15,7 +16,7 @@
/// 礼物图标列表(按 items 数量动态增减) /// 礼物图标列表(按 items 数量动态增减)
@property (nonatomic, strong) NSMutableArray<UIImageView *> *giftIconViews; @property (nonatomic, strong) NSMutableArray<UIImageView *> *giftIconViews;
/// 礼物数量 label 列表(按 items 数量动态增减) /// 礼物数量 label 列表(按 items 数量动态增减)
@property (nonatomic, strong) NSMutableArray<UILabel *> *giftCountLabels; @property (nonatomic, strong) NSMutableArray<CBAutoScrollLabel *> *giftCountLabels;
/// 当前展示的条目数组 /// 当前展示的条目数组
@property (nonatomic, copy) NSArray<FUSLiveGiftInteractSettingItemModel *> *items; @property (nonatomic, copy) NSArray<FUSLiveGiftInteractSettingItemModel *> *items;
@end @end
...@@ -86,7 +87,7 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen ...@@ -86,7 +87,7 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen
[self.giftIconViews removeLastObject]; [self.giftIconViews removeLastObject];
} }
while (self.giftCountLabels.count > targetCount) { while (self.giftCountLabels.count > targetCount) {
UILabel *label = self.giftCountLabels.lastObject; CBAutoScrollLabel *label = self.giftCountLabels.lastObject;
[label removeFromSuperview]; [label removeFromSuperview];
[self.giftCountLabels removeLastObject]; [self.giftCountLabels removeLastObject];
} }
...@@ -108,11 +109,11 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen ...@@ -108,11 +109,11 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen
[self.giftIconViews addObject:imgView]; [self.giftIconViews addObject:imgView];
} }
while (self.giftCountLabels.count < targetCount) { while (self.giftCountLabels.count < targetCount) {
UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero]; CBAutoScrollLabel *label = [[CBAutoScrollLabel alloc] initWithFrame:CGRectZero];
label.font = [UIFont fus_themeFont:11]; label.font = [UIFont fus_themeFont:11];
label.textColor = UIColor.whiteColor; label.textColor = UIColor.whiteColor;
label.textAlignment = NSTextAlignmentLeft; label.textAlignment = NSTextAlignmentLeft;
label.numberOfLines = 1; [label observeApplicationNotifications];
[self addSubview:label]; [self addSubview:label];
[self.giftCountLabels addObject:label]; [self.giftCountLabels addObject:label];
} }
...@@ -139,7 +140,7 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen ...@@ -139,7 +140,7 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen
[giftIconView setImageWithURL:url placeholder:placeholder options:0 completion:nil]; [giftIconView setImageWithURL:url placeholder:placeholder options:0 completion:nil];
} }
UILabel *countLabel = self.giftCountLabels[i]; CBAutoScrollLabel *countLabel = self.giftCountLabels[i];
NSInteger giftNum = model.giftNum; NSInteger giftNum = model.giftNum;
countLabel.text = (giftNum > 0 ? [NSString stringWithFormat:@"x%ld", (long)giftNum] : @""); countLabel.text = (giftNum > 0 ? [NSString stringWithFormat:@"x%ld", (long)giftNum] : @"");
} }
...@@ -195,7 +196,7 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen ...@@ -195,7 +196,7 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen
UIImageView *iconView = self.giftIconViews[i]; UIImageView *iconView = self.giftIconViews[i];
iconView.frame = CGRectMake(giftIconX, y + (rowHeight - giftIconSize) * 0.5, giftIconSize, giftIconSize); iconView.frame = CGRectMake(giftIconX, y + (rowHeight - giftIconSize) * 0.5, giftIconSize, giftIconSize);
UILabel *countLabel = self.giftCountLabels[i]; CBAutoScrollLabel *countLabel = self.giftCountLabels[i];
countLabel.frame = CGRectMake(giftCountX, y, countW, rowHeight); countLabel.frame = CGRectMake(giftCountX, y, countW, rowHeight);
} }
} }
......
#import "FUSLiveGiftInteractTaskPanelView.h" #import "FUSLiveGiftInteractTaskPanelView.h"
#import "FUSLiveGiftInteractSettingItemModel.h" #import "FUSLiveGiftInteractSettingItemModel.h"
#import "CBAutoScrollLabel.h"
@interface FUSLiveGiftInteractTaskPanelView () @interface FUSLiveGiftInteractTaskPanelView ()
/// 顶部标题栏 /// 顶部标题栏
...@@ -17,7 +18,7 @@ ...@@ -17,7 +18,7 @@
/// 昵称 label 列表(按 items 数量动态增减) /// 昵称 label 列表(按 items 数量动态增减)
@property (nonatomic, strong) NSMutableArray<UILabel *> *nicknameLabels; @property (nonatomic, strong) NSMutableArray<UILabel *> *nicknameLabels;
/// 任务文案 label 列表(按 items 数量动态增减) /// 任务文案 label 列表(按 items 数量动态增减)
@property (nonatomic, strong) NSMutableArray<UILabel *> *taskLabels; @property (nonatomic, strong) NSMutableArray<CBAutoScrollLabel *> *taskLabels;
/// 右侧“消失”按钮列表(按 taskTexts 数量动态增减) /// 右侧“消失”按钮列表(按 taskTexts 数量动态增减)
@property (nonatomic, strong) NSMutableArray<UIButton *> *doneButtons; @property (nonatomic, strong) NSMutableArray<UIButton *> *doneButtons;
@end @end
...@@ -89,7 +90,7 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen ...@@ -89,7 +90,7 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen
[self.nicknameLabels removeLastObject]; [self.nicknameLabels removeLastObject];
} }
while (self.taskLabels.count > targetCount) { while (self.taskLabels.count > targetCount) {
UILabel *label = self.taskLabels.lastObject; CBAutoScrollLabel *label = self.taskLabels.lastObject;
[label removeFromSuperview]; [label removeFromSuperview];
[self.taskLabels removeLastObject]; [self.taskLabels removeLastObject];
} }
...@@ -116,12 +117,11 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen ...@@ -116,12 +117,11 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen
[self.nicknameLabels addObject:label]; [self.nicknameLabels addObject:label];
} }
while (self.taskLabels.count < targetCount) { while (self.taskLabels.count < targetCount) {
UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero]; CBAutoScrollLabel *label = [[CBAutoScrollLabel alloc] initWithFrame:CGRectZero];
label.font = [UIFont fus_themeFont:10]; label.font = [UIFont fus_themeFont:10];
label.textColor = UIColor.whiteColor; label.textColor = UIColor.whiteColor;
label.textAlignment = NSTextAlignmentRight; label.textAlignment = NSTextAlignmentRight;
label.lineBreakMode = NSLineBreakByTruncatingTail; [label observeApplicationNotifications];
[self addSubview:label]; [self addSubview:label];
[self.taskLabels addObject:label]; [self.taskLabels addObject:label];
} }
...@@ -148,9 +148,9 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen ...@@ -148,9 +148,9 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen
NSString *nickname = model.userNickname ?: @""; NSString *nickname = model.userNickname ?: @"";
nicknameLabel.text = fus_substringComposedToLength(nickname, 4); nicknameLabel.text = fus_substringComposedToLength(nickname, 4);
UILabel *taskLabel = self.taskLabels[i]; CBAutoScrollLabel *taskLabel = self.taskLabels[i];
NSString *task = model.name ?: @""; NSString *task = model.name ?: @"";
taskLabel.text = fus_substringComposedToLength(task, 6); taskLabel.text = task;
UIButton *btn = self.doneButtons[i]; UIButton *btn = self.doneButtons[i];
btn.tag = i; btn.tag = i;
...@@ -211,7 +211,7 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen ...@@ -211,7 +211,7 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen
UILabel *nicknameLabel = self.nicknameLabels[i]; UILabel *nicknameLabel = self.nicknameLabels[i];
nicknameLabel.frame = CGRectMake(nicknameX, y, nicknameW, rowHeight); nicknameLabel.frame = CGRectMake(nicknameX, y, nicknameW, rowHeight);
UILabel *taskLabel = self.taskLabels[i]; CBAutoScrollLabel *taskLabel = self.taskLabels[i];
taskLabel.frame = CGRectMake(taskX, y, taskW, rowHeight); taskLabel.frame = CGRectMake(taskX, y, taskW, rowHeight);
UIButton *btn = self.doneButtons[i]; UIButton *btn = self.doneButtons[i];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment