Commit 4ce91233c118ab8ab163dd0deccefc8d619ea13a

Authored by zhangxiaowen
1 parent 53adbf8b

no message

CNLiveScioLive/Pages/Home/外宣要闻/View/CNLiveNewsLeftPicTableViewCell.m
@@ -78,19 +78,39 @@ @@ -78,19 +78,39 @@
78 _model = model; 78 _model = model;
79 _titleLabel.text = model.title; 79 _titleLabel.text = model.title;
80 _timeLabel.text = [model.createDate componentsSeparatedByString:@" "][0]; 80 _timeLabel.text = [model.createDate componentsSeparatedByString:@" "][0];
  81 + [_picImage sd_setImageWithURL:[NSURL URLWithString:model.img] placeholderImage:[UIImage imageNamed:@"placeholder"]];
  82 +
  83 + //专题
81 if(model.tags && ![model.tags isEqualToString:@""]){ 84 if(model.tags && ![model.tags isEqualToString:@""]){
82 _projectLabel.text = model.tags; 85 _projectLabel.text = model.tags;
83 - 86 + _projectLabel.hidden = NO;
  87 +
84 }else if(model.subjecttag && ![model.subjecttag isEqualToString:@""]){ 88 }else if(model.subjecttag && ![model.subjecttag isEqualToString:@""]){
85 _projectLabel.text = model.subjecttag; 89 _projectLabel.text = model.subjecttag;
  90 + _projectLabel.hidden = NO;
  91 +
  92 + }else{
  93 + _projectLabel.hidden = YES;
  94 +
  95 + }
  96 +
  97 + if ([_model.type isEqualToString:@"program"]) {
  98 + _playImage.hidden = NO;
  99 + _playImage.frame = CGRectMake(10+5+((80*MainScale)*16.0/9.0-30*MainScale)/2.0, (self.contentView.height-30*MainScale)/2.0, 30*MainScale, 30*MainScale);
  100 +
  101 + }
  102 + else if ([_model.type isEqualToString:@"subject"]) {
  103 + _playImage.hidden = YES;
  104 +
  105 + }
  106 + else if ([_model.type isEqualToString:@"article"]) {
  107 + _playImage.hidden = YES;
86 108
87 } 109 }
88 - [_picImage sd_setImageWithURL:[NSURL URLWithString:model.img] placeholderImage:[UIImage imageNamed:@"placeholder"]];  
89 - [self layoutSubviews];  
90 110
91 } 111 }
92 - (void)layoutSubviews{ 112 - (void)layoutSubviews{
93 - 113 + [super layoutSubviews];
94 [_backgroundImage mas_updateConstraints:^(MASConstraintMaker *make) { 114 [_backgroundImage mas_updateConstraints:^(MASConstraintMaker *make) {
95 make.left.equalTo(self.mas_left).with.offset(10); 115 make.left.equalTo(self.mas_left).with.offset(10);
96 make.right.equalTo(self.mas_right).with.offset(-10); 116 make.right.equalTo(self.mas_right).with.offset(-10);
@@ -119,19 +139,7 @@ @@ -119,19 +139,7 @@
119 make.right.equalTo(self->_backgroundImage.mas_right).with.offset(-5); 139 make.right.equalTo(self->_backgroundImage.mas_right).with.offset(-5);
120 make.bottom.equalTo(self->_backgroundImage.mas_bottom).with.offset(-5); 140 make.bottom.equalTo(self->_backgroundImage.mas_bottom).with.offset(-5);
121 }]; 141 }];
122 - if ([_model.type isEqualToString:@"program"]) {  
123 - _playImage.hidden = NO;  
124 - _playImage.frame = CGRectMake(10+5+((80*MainScale)*16.0/9.0-30*MainScale)/2.0, (self.contentView.height-30*MainScale)/2.0, 30*MainScale, 30*MainScale);  
125 -  
126 - }  
127 - else if ([_model.type isEqualToString:@"subject"]) {  
128 - _playImage.hidden = YES;  
129 -  
130 - }  
131 - else if ([_model.type isEqualToString:@"article"]) {  
132 - _playImage.hidden = YES;  
133 -  
134 - } 142 +
135 [_projectLabel mas_updateConstraints:^(MASConstraintMaker *make) { 143 [_projectLabel mas_updateConstraints:^(MASConstraintMaker *make) {
136 make.right.equalTo(self->_backgroundImage.mas_right).with.offset(-10); 144 make.right.equalTo(self->_backgroundImage.mas_right).with.offset(-10);
137 make.bottom.equalTo(self->_backgroundImage.mas_bottom).with.offset(-5); 145 make.bottom.equalTo(self->_backgroundImage.mas_bottom).with.offset(-5);