| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- //
- // MyattentionCell.m
- // jitao
- //
- // Created by 罗云飞 on 2017/12/9.
- // Copyright © 2017年 罗云飞. All rights reserved.
- //
- #import "MyattentionCell.h"
- @implementation MyattentionCell
- - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
-
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
- if (self) {
- _image = [UIImageView new];
- ViewRadius(_image, fitScreenWidth(38)/2);
- [self.contentView addSubview:_image];
-
- _image.sd_layout
- .leftSpaceToView(self.contentView, 15)
- .centerYEqualToView(self.contentView)
- .widthIs(fitScreenWidth(38))
- .heightIs(fitScreenWidth(38));
-
- _title = [UILabel new];
- _title.font = NewFont(fitScreenWidth(15));
- _title.textColor = NewBlackColor;
- _title.lineBreakMode = NSLineBreakByTruncatingTail;
- _title.numberOfLines = 1;
- [self.contentView addSubview:_title];
-
- _title.sd_layout
- .leftSpaceToView(_image, fitScreenWidth(8))
- .topEqualToView(_image)
- .heightIs(fitScreenWidth(15))
- .rightSpaceToView(self.contentView, fitScreenWidth(70));
-
- UILabel *line = [UILabel new];
- line.backgroundColor = NewLineGrayColor;
- [self.contentView addSubview:line];
-
- line.sd_layout
- .bottomEqualToView(self.contentView)
- .heightIs(0.8)
- .leftEqualToView(self.contentView)
- .rightEqualToView(self.contentView);
-
- _time = [UILabel new];
- _time.textColor = [UIColor colorWithString:@"#9A9A9A"];
- _time.font = NewFont(fitScreenWidth(11));
- [_time setSingleLineAutoResizeWithMaxWidth:0];
- [self.contentView addSubview:_time];
-
- _time.sd_layout
- .leftEqualToView(_title)
- .bottomSpaceToView(self.contentView, fitScreenWidth(15))
- .heightIs(fitScreenWidth(10));
-
- _follow = [UIButton new];
- [_follow setImage:[UIImage imageNamed:@"关注"] forState:UIControlStateNormal];
- [self.contentView addSubview:_follow];
-
- _follow.sd_layout
- .rightSpaceToView(self.contentView, 30)
- .centerYEqualToView(self.contentView)
- .heightIs(16)
- .widthIs(16);
-
- _countInterest = [UILabel new];
- _countInterest.font = NewFont(fitScreenWidth(12));
- [_countInterest setSingleLineAutoResizeWithMaxWidth:0];
- [self.contentView addSubview:_countInterest];
-
- _countInterest.sd_layout
- .centerYEqualToView(_time)
- .heightIs(15)
- .centerXEqualToView(_follow);
- }
- return self;
- }
- - (void)assignment:(MyattentionModel *)model {
- _title.text = model.name;
- _time.text = model.createTimeFormattedDate;
- if ([model.type isEqualToString:@"0"]) {
- [_image setImage:[UIImage imageNamed:@"成果"]];
- }else if ([model.type isEqualToString:@"1"]){
- [_image setImage:[UIImage imageNamed:@"需求"]];
- }else if ([model.type isEqualToString:@"2"]){
- [_image setImage:[UIImage imageNamed:@"专家"]];
- }else if ([model.type isEqualToString:@"7"]){
- [_image setImage:[UIImage imageNamed:@"咨询师"]];
- }else if ([model.type isEqualToString:@"5"]){
- [_image setImage:[UIImage imageNamed:@"项目"]];
- }
- _countInterest.text = model.countInterest;
- }
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- @end
|