newNoImageCell.m 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. //
  2. // newNoImageCell.m
  3. // ZhongJingLianMeng
  4. //
  5. // Created by youke on 2018/11/15.
  6. // Copyright © 2018 youke. All rights reserved.
  7. //
  8. #import "newNoImageCell.h"
  9. #import "newModel.h"
  10. @implementation newNoImageCell
  11. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  12. {
  13. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  14. if (self) {
  15. // Initialization code
  16. [self makeUI];
  17. }
  18. return self;
  19. }
  20. -(void)makeUI{
  21. _titleLb= [[UILabel alloc]init];
  22. _titleLb.textAlignment = NSTextAlignmentLeft;
  23. _titleLb.font = TextFont(16);
  24. _titleLb.textColor = [UIColor colorWithHexValue:0x333333];
  25. _titleLb.numberOfLines = 0;
  26. _titleLb.text =@"中经联盟武汉分盟正式成立!关于中经联盟地产杰出人物于中经联盟地产杰出人物武汉分盟正式成立!";
  27. [_titleLb setRowSpace:8];
  28. [self.contentView addSubview:_titleLb];
  29. [_titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
  30. make.size.mas_equalTo(CGSizeMake(kGScreenWidth -30, 55));
  31. make.left.equalTo(self.mas_left).with.offset(15);
  32. make.top.equalTo(self.mas_top).with.offset(10);
  33. }];
  34. _timeLb = [[UILabel alloc]init];
  35. _timeLb.textAlignment = NSTextAlignmentLeft;
  36. _timeLb.font = TextFont(12);
  37. _timeLb.textColor = [UIColor colorWithHexValue:0x898989];
  38. _timeLb.text = @"2018-11-15";
  39. [self.contentView addSubview:_timeLb];
  40. [_timeLb mas_makeConstraints:^(MASConstraintMaker *make) {
  41. make.size.mas_equalTo(CGSizeMake(80, 10));
  42. make.left.equalTo(self.mas_left).offset(15);
  43. make.bottom.equalTo(self.mas_bottom).offset(-15);
  44. }];
  45. UIView *lineView =[[UIView alloc]init];
  46. lineView.backgroundColor = [[UIColor colorWithHexValue:0xEAEAEA]colorWithAlphaComponent:0.6];
  47. [self.contentView addSubview:lineView];
  48. [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
  49. make.bottom.equalTo(self.mas_bottom).offset(0);
  50. make.left.equalTo(self.mas_left).offset(10);
  51. make.size.mas_equalTo(CGSizeMake(kGScreenWidth-20, 1));
  52. }];
  53. }
  54. + (newNoImageCell *)cellWith:(newModel*)model
  55. tableView:(UITableView *)tableView{
  56. static NSString *cellID = @"CellID2";
  57. newNoImageCell *cell =
  58. [tableView dequeueReusableCellWithIdentifier:cellID];
  59. if (!cell) {
  60. cell =
  61. [[newNoImageCell alloc] initWithStyle:UITableViewCellStyleDefault
  62. reuseIdentifier:cellID];
  63. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  64. }
  65. [cell fillData:model];
  66. return cell;
  67. }
  68. -(void)fillData:(newModel*)model{
  69. _titleLb.text = model.title;
  70. _timeLb.text = model.createTime;
  71. }
  72. - (void)awakeFromNib {
  73. [super awakeFromNib];
  74. // Initialization code
  75. }
  76. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  77. [super setSelected:selected animated:animated];
  78. // Configure the view for the selected state
  79. }
  80. @end