动态完成了

This commit is contained in:
fengshuo
2022-08-18 16:39:14 +08:00
parent 30d4e2f354
commit 0ac8ac5b51
37 changed files with 1739 additions and 9 deletions

View File

@@ -0,0 +1,116 @@
//
// XPMonentsTopicHeaderView.m
// xplan-ios
//
// Created by on 2022/8/18.
//
#import "XPMonentsTopicHeaderView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "XPMacro.h"
#import "NetImageView.h"
///Model
#import "MonentsTopicModel.h"
@interface XPMonentsTopicHeaderView ()
@property (nonatomic,strong) UILabel *titleLabel;
@property (nonatomic,strong) UILabel *descLabel;
@property (nonatomic,strong) NetImageView *logoImageView;
@property (nonatomic,strong) UIView * alphaView;
@end
@implementation XPMonentsTopicHeaderView
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.logoImageView];
[self addSubview:self.alphaView];
[self addSubview:self.titleLabel];
[self addSubview:self.descLabel];
}
- (void)initSubViewConstraints {
[self.logoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self);
}];
[self.alphaView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self).offset(kNavigationHeight + 10);
make.left.mas_equalTo(self).offset(30);
}];
[self.descLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.titleLabel);
make.right.mas_equalTo(self).offset(-10);
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(20);
}];
}
#pragma mark - Getters And Setters
- (void)setTopicInfo:(MonentsTopicModel *)topicInfo {
_topicInfo = topicInfo;
if (_topicInfo) {
self.logoImageView.imageUrl = _topicInfo.icon;
self.titleLabel.text = _topicInfo.name;
self.descLabel.text = _topicInfo.desc;
}
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:18];
_titleLabel.textColor = [UIColor whiteColor];
}
return _titleLabel;
}
- (UILabel *)descLabel {
if (!_descLabel) {
_descLabel = [[UILabel alloc] init];
_descLabel.font = [UIFont systemFontOfSize:14];
_descLabel.textColor = [UIColor whiteColor];
_descLabel.numberOfLines = 2;
}
return _descLabel;
}
- (NetImageView *)logoImageView {
if (!_logoImageView) {
_logoImageView = [[NetImageView alloc] init];
_logoImageView.userInteractionEnabled = YES;
_logoImageView.layer.masksToBounds = YES;
_logoImageView.contentMode = UIViewContentModeScaleAspectFill;
}
return _logoImageView;
}
- (UIView *)alphaView {
if (!_alphaView) {
_alphaView = [[UIView alloc] init];
_alphaView.backgroundColor = [UIColor blackColor];
_alphaView.alpha = 0.5;
}
return _alphaView;
}
@end