68 lines
1.8 KiB
Objective-C
68 lines
1.8 KiB
Objective-C
//
|
|
// QXSelectedTopicView.m
|
|
// QXLive
|
|
//
|
|
// Created by 启星 on 2025/5/27.
|
|
//
|
|
|
|
#import "QXSelectedTopicView.h"
|
|
@interface QXSelectedTopicView()
|
|
@property (nonatomic,strong)UILabel *titleLabel;
|
|
@property (nonatomic,strong)UIImageView *arrowImageView;
|
|
@end
|
|
|
|
@implementation QXSelectedTopicView
|
|
|
|
- (instancetype)init
|
|
{
|
|
self = [super init];
|
|
if (self) {
|
|
[self initSubviews];
|
|
}
|
|
return self;
|
|
}
|
|
- (instancetype)initWithFrame:(CGRect)frame
|
|
{
|
|
self = [super initWithFrame:frame];
|
|
if (self) {
|
|
[self initSubviews];
|
|
}
|
|
return self;
|
|
}
|
|
-(void)initSubviews{
|
|
self.titleLabel = [[UILabel alloc] init];
|
|
self.titleLabel.text = QXText(@"选择话题");
|
|
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
|
self.titleLabel.textColor = QXConfig.textColor;
|
|
[self addSubview:self.titleLabel];
|
|
|
|
|
|
self.arrowImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"arrowRight"]];
|
|
[self addSubview:self.arrowImageView];
|
|
[self.arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.right.mas_equalTo(-12);
|
|
make.size.mas_equalTo(CGSizeMake(16, 16));
|
|
make.centerY.equalTo(self);
|
|
}];
|
|
|
|
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.mas_equalTo(12);
|
|
make.right.equalTo(self.arrowImageView.mas_left).offset(-12);
|
|
make.centerY.equalTo(self);
|
|
}];
|
|
|
|
}
|
|
-(void)setSelectedTopic:(NSArray< QXTopicModel *>*)selectedTopic{
|
|
_selectedTopic = selectedTopic;
|
|
NSString *topic = @"";
|
|
for (QXTopicModel*md in selectedTopic) {
|
|
if (topic.length == 0) {
|
|
topic = [topic stringByAppendingFormat:@"%@",md.title];
|
|
}else{
|
|
topic = [topic stringByAppendingFormat:@",%@",md.title];
|
|
}
|
|
}
|
|
self.titleLabel.text = topic;
|
|
}
|
|
@end
|