123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- //
- // MyTDTopicCellView.m
- // smartRhino
- //
- // Created by tederen on 2019/10/31.
- // Copyright © 2019 tederen. All rights reserved.
- //
- #import "MyTDTopicCellView.h"
- #import "MyTDTopicModel.h"
- #import "MyTDTopicModelSub.h"
- @interface MyTDTopicCellView()
- @property (nonatomic, strong) UIView *myBackgroundView;
- @property (nonatomic, strong) UIImageView *articlaImage;
- @property (nonatomic, strong) UILabel *articleNamelab;
- @property (nonatomic, strong) UILabel *articleContentLab;
- @property (nonatomic, strong) UILabel *sourceLab;
- @property (nonatomic, strong) TDButton *closeButton;
- @end
- @implementation MyTDTopicCellView
- - (void)loadTopicData:(MyTDTopicModel *)model{
- MyTDTopicModelSub *mymodel = model.noteArray.firstObject;
- self.articlaImage.image = mymodel.noteImage;
- self.articleNamelab.text = mymodel.noteTitle;
- self.articleContentLab.text = mymodel.noteContent;
- [ZYCTool setLabel:self.articleContentLab withSpace:1 withFont:[UIFont systemFontOfSize:12.f] setLineSpace:0 setTextSpace:0.1];
- self.sourceLab.text = mymodel.noteSource;
-
- CGRect frame = self.frame;
- frame.size.height = 110;
- self.frame = frame;
- // self.closeButton
- }
- - (instancetype)initWithFrame:(CGRect)frame
- {
- self = [super initWithFrame:frame];
- if (self) {
- [self addSubview:self.myBackgroundView];
- [self.myBackgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.equalTo(self).offset(15);
- make.right.equalTo(self).offset(-15);
- make.top.equalTo(self);
- make.height.mas_equalTo(90);
- }];
- [self.myBackgroundView addSubview:self.articlaImage];
- [self.articlaImage mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.myBackgroundView).offset(10);
- make.top.equalTo(self.myBackgroundView).offset(20);
- make.width.height.mas_equalTo(50);
- }];
- [self.myBackgroundView addSubview:self.articleNamelab];
- [self.articleNamelab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.articlaImage.mas_right).offset(10);
- make.top.equalTo(self.myBackgroundView).offset(10);
- make.right.equalTo(self.myBackgroundView).offset(-35);
- make.height.mas_equalTo(15);
- }];
- [self.myBackgroundView addSubview:self.articleContentLab];
- [self.articleContentLab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.articlaImage.mas_right).offset(10);
- make.top.equalTo(self.articleNamelab.mas_bottom).offset(10);
- make.right.equalTo(self.myBackgroundView).offset(-35);
- make.height.mas_equalTo(30);
- }];
- [self.myBackgroundView addSubview:self.sourceLab];
- [self.sourceLab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.articlaImage.mas_right).offset(10);
- make.top.equalTo(self.articleContentLab.mas_bottom).offset(5);
- }];
- [self.myBackgroundView addSubview:self.closeButton];
- [self.closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(self.myBackgroundView).offset(-10);
- make.top.equalTo(self.myBackgroundView).offset(10);
- make.width.height.mas_equalTo(10);
- }];
-
- }
- return self;
- }
- - (UIImageView *)articlaImage{
- if (!_articlaImage) {
- _articlaImage = [UIImageView new];
- }
- return _articlaImage;
- }
- - (UILabel *)articleNamelab{
- if (!_articleNamelab) {
- _articleNamelab = [UILabel new];
- _articleNamelab.textColor = UIColorHex(333333);
- _articleNamelab.font = [UIFont systemFontOfSize:15.f weight:UIFontWeightLight];
-
- }
- return _articleNamelab;
- }
- - (UILabel *)articleContentLab{
- if (!_articleContentLab) {
- _articleContentLab = [UILabel new];
- _articleContentLab.textColor = UIColorHex(999999);
- _articleContentLab.font = [UIFont systemFontOfSize:12.f weight:UIFontWeightLight];
- _articleContentLab.numberOfLines = 0;
- }
- return _articleContentLab;
- }
- - (UILabel *)sourceLab{
- if (!_sourceLab) {
- _sourceLab = [UILabel new];
- _sourceLab.textColor = UIColorHex(999999);
-
- _sourceLab.font = [UIFont systemFontOfSize:12.f weight:UIFontWeightLight];
- _sourceLab.textAlignment = NSTextAlignmentLeft;
- _sourceLab.numberOfLines = 0;
-
- }
- return _sourceLab;
- }
- - (TDButton *)closeButton{
- if (!_closeButton) {
- _closeButton = [[TDButton alloc]init];
- [_closeButton setImage:IMG(@"叉号") forState:UIControlStateNormal];
- [_closeButton setCurrentButtonHotSize:CGSizeZero];
- }
- return _closeButton;
- }
- - (UIView *)myBackgroundView{
- if (!_myBackgroundView){
- _myBackgroundView = [UIView new];
- _myBackgroundView.backgroundColor = UIColorHex(F4F5F5);
- }
- return _myBackgroundView;
- }
- @end
|