Files
midi_ios/QXLive/HomePage(声播)/View/首页/搜索/QXSearchHeaderView.m
2025-08-14 10:07:49 +08:00

49 lines
1.4 KiB
Objective-C

//
// QXSearchHeaderView.m
// QXLive
//
// Created by 启星 on 2025/5/8.
//
#import "QXSearchHeaderView.h"
@interface QXSearchHeaderView()
@property (nonatomic,strong)UILabel *headerLabel;
@end
@implementation QXSearchHeaderView
+ (NSString *)headerViewIdentifier {
return @"QXSearchHeaderView";
}
+ (instancetype)headerViewWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath {
QXSearchHeaderView *headerView = (QXSearchHeaderView*)[collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:[QXSearchHeaderView headerViewIdentifier] forIndexPath:indexPath];
headerView.backgroundColor = [UIColor clearColor];
return headerView;
}
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self addSubview:self.headerLabel];
[self.headerLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self);
make.left.mas_equalTo(16);
}];
}
return self;
}
-(void)setTitle:(NSString *)title{
_title = title;
self.headerLabel.text = title;
}
- (UILabel*)headerLabel {
if (!_headerLabel) {
_headerLabel = [[UILabel alloc]init];
_headerLabel.font = [UIFont boldSystemFontOfSize:16];
_headerLabel.textColor = QXConfig.textColor;
}
return _headerLabel;
}
@end