1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- //
- // MyTDTopicTitleView.m
- // smartRhino
- //
- // Created by tederen on 2019/10/31.
- // Copyright © 2019 tederen. All rights reserved.
- //
- #import "MyTDTopicTitleView.h"
- #import "MyTDTopicModel.h"
- @interface MyTDTopicTitleView()
- @property (nonatomic, strong) UILabel *selectKeyLabel;
- @property (nonatomic, strong) UILabel *topicTitlelabel;
- @property (nonatomic, strong) UILabel *topicContentlabel;
- @property (nonatomic, strong) UIView *lineView;
- @end
- @implementation MyTDTopicTitleView
- - (void)loadTopicData:(MyTDTopicModel *)model{
- CGFloat topMargin = 17;
- self.selectKeyLabel.text = @"标题: ";
- self.topicTitlelabel.text = model.topicName;
- [ZYCTool setLabel:self.topicTitlelabel withSpace:5 withFont:[UIFont systemFontOfSize:18.f weight:UIFontWeightLight] setLineSpace:0 setTextSpace:0.2];
- CGSize workGroupSize = [self.topicTitlelabel sizeThatFits:CGSizeMake(kGXScreenWidth -67-20, 41)];
- CGRect workFrame = self.topicTitlelabel.frame;
- workFrame.size = workGroupSize;
- workFrame.origin.y = topMargin-2;
- workFrame.origin.x = 67.5;
- self.topicTitlelabel.frame = workFrame;
-
- topMargin += workFrame.size.height;
- topMargin += 16.5;
-
-
- CGRect lineFrame = self.lineView.frame;
- lineFrame.origin.y = topMargin;
- self.lineView.frame = lineFrame;
-
- topMargin += 16.5;
-
- self.topicContentlabel.text = model.topicContent;
- [ZYCTool setLabel:self.topicContentlabel withSpace:5 withFont:[UIFont systemFontOfSize:18.f weight:UIFontWeightThin] setLineSpace:0 setTextSpace:0.2];
- CGSize topicContentSize = [self.topicContentlabel sizeThatFits:CGSizeMake(kGXScreenWidth -45,MAXFLOAT)];
- self.topicContentlabel.frame = CGRectMake(15, topMargin,topicContentSize.width,topicContentSize.height);
-
- topMargin += topicContentSize.height ;
- topMargin += 50;
-
-
- CGRect frame = self.frame;
- frame.size.height = topMargin;
- self.frame = frame;
- }
- - (instancetype)initWithFrame:(CGRect)frame{
- self =[super initWithFrame:frame];
- if (self) {
- UILabel *selectKeyLabel = [[UILabel alloc]initWithFrame:CGRectMake(15.5, 17.5, 70.5, 15.5)];
- selectKeyLabel.textColor = UIColorHex(999999);
- selectKeyLabel.font = [UIFont systemFontOfSize:16.f];
- [self addSubview:selectKeyLabel];
- self.selectKeyLabel = selectKeyLabel;
- [self addSubview:self.topicTitlelabel];
- [self addSubview:self.lineView];
- [self addSubview:self.topicContentlabel];
- }
- return self;
- }
- - (UILabel *)topicTitlelabel {
- if (!_topicTitlelabel) {
- _topicTitlelabel = [UILabel new];
- _topicTitlelabel.numberOfLines = 0;
- }
- return _topicTitlelabel;
- }
- - (UIView *)lineView{
- if (!_lineView) {
- _lineView = [UIView new];
- _lineView.frame = CGRectMake(15, 0,kGXScreenWidth -30, 1);
- _lineView.backgroundColor = UIColorHex(B1D8FF);
- }
- return _lineView;
- }
- - (UILabel *)topicContentlabel{
- if (!_topicContentlabel) {
- _topicContentlabel = [UILabel new];
- _topicContentlabel.numberOfLines = 0;
- }
- return _topicContentlabel;
- }
- @end
|