No Description

FKRecoNewsListCell.m 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. //
  2. // FKRecoNewsListCell.m
  3. // FirstLink
  4. //
  5. // Created by ascii on 2017/6/10.
  6. // Copyright © 2017年 FirstLink. All rights reserved.
  7. //
  8. #import "FKRecoNewsListCell.h"
  9. @interface FKRecoNewsListCell ()
  10. @end
  11. @implementation FKRecoNewsListCell
  12. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  13. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  14. if (self) {
  15. self.selectionStyle = UITableViewCellSelectionStyleNone;
  16. [self setupViews];
  17. }
  18. return self;
  19. }
  20. #pragma mark - Method
  21. - (void)setupViews {
  22. [self.contentView addSubview:self.headImgView];
  23. [self.headImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  24. make.centerY.equalTo(self.contentView);
  25. make.left.equalTo(self.contentView).offset(12);
  26. make.size.mas_equalTo(CGSizeMake(59, 59));
  27. }];
  28. [self.contentView addSubview:self.titleLabel];
  29. [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  30. make.top.equalTo(self.contentView).offset(12);
  31. make.left.equalTo(self.headImgView.mas_right).offset(19);
  32. make.right.equalTo(self.contentView).offset(-12);
  33. }];
  34. [self.contentView addSubview:self.authorLabel];
  35. [self.authorLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  36. make.top.equalTo(self.titleLabel.mas_bottom).offset(4);
  37. make.left.equalTo(self.titleLabel);
  38. }];
  39. [self.contentView addSubview:self.bottomLine];
  40. [self.bottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
  41. make.left.bottom.right.equalTo(self.contentView);
  42. make.height.mas_equalTo(1.0/[UIScreen mainScreen].scale);
  43. }];
  44. }
  45. #pragma mark - Property
  46. - (UIImageView *)headImgView {
  47. if (!_headImgView) {
  48. _headImgView = [UIImageView new];
  49. _headImgView.contentMode = UIViewContentModeScaleAspectFit;
  50. _headImgView.layer.cornerRadius = 2;
  51. }
  52. return _headImgView;
  53. }
  54. - (UILabel *)titleLabel {
  55. if (!_titleLabel) {
  56. _titleLabel = [UILabel new];
  57. _titleLabel.font = [UIFont systemFontOfSize:14];
  58. _titleLabel.textColor = UIColorFromRGB(0x333333);
  59. _titleLabel.numberOfLines = 2;
  60. }
  61. return _titleLabel;
  62. }
  63. - (UILabel *)authorLabel {
  64. if (!_authorLabel) {
  65. _authorLabel = [UILabel new];
  66. _authorLabel.font = [UIFont systemFontOfSize:12];
  67. _authorLabel.textColor = UIColorFromRGB(0x999999);
  68. }
  69. return _authorLabel;
  70. }
  71. - (UIView *)bottomLine {
  72. if (!_bottomLine) {
  73. _bottomLine = [UIView new];
  74. _bottomLine.backgroundColor = UIColorFromRGB(0xf4f4f4);
  75. }
  76. return _bottomLine;
  77. }
  78. @end