No Description

FKRecoUserCollectionViewCell.m 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. //
  2. // FKRecoUserCollectionViewCell.m
  3. // FirstLink
  4. //
  5. // Created by ascii on 16/2/18.
  6. // Copyright © 2016年 FirstLink. All rights reserved.
  7. //
  8. #import "FKRecoUserCollectionViewCell.h"
  9. @interface FKRecoUserCollectionViewCell ()
  10. @property (nonatomic, strong) UIView *imgBgView;
  11. @end
  12. @implementation FKRecoUserCollectionViewCell
  13. - (instancetype)initWithFrame:(CGRect)frame {
  14. if (self = [super initWithFrame:frame]) {
  15. [self addAllSubviews];
  16. }
  17. return self;
  18. }
  19. - (void)addAllSubviews {
  20. [self.contentView addSubview:self.imgBgView];
  21. [self.imgBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  22. make.left.right.equalTo(self.contentView);
  23. make.top.equalTo(self.contentView).offset(10);
  24. make.height.equalTo(self.contentView.mas_width);
  25. }];
  26. [self.imgBgView addSubview:self.imageView];
  27. [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
  28. make.left.right.equalTo(self.imgBgView);
  29. make.top.equalTo(self.imgBgView);
  30. make.height.equalTo(self.imageView.mas_width);
  31. }];
  32. [self.contentView addSubview:self.titleLabel];
  33. [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  34. make.left.right.equalTo(self.contentView);
  35. make.top.equalTo(self.imgBgView.mas_bottom).offset(8);
  36. make.height.mas_equalTo(15);
  37. }];
  38. [self.contentView addSubview:self.priceLabel];
  39. [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  40. make.left.right.equalTo(self.contentView);
  41. make.top.equalTo(self.titleLabel.mas_bottom).offset(4);
  42. make.height.mas_equalTo(18);
  43. }];
  44. }
  45. #pragma mark - Property
  46. - (UIView *)imgBgView {
  47. if (!_imgBgView) {
  48. _imgBgView = [UIView new];
  49. // _imgBgView.layer.borderWidth = 1.0/[UIScreen mainScreen].scale;
  50. // _imgBgView.layer.borderColor = UIColorFromRGB(0xe5e5e5).CGColor;
  51. }
  52. return _imgBgView;
  53. }
  54. - (UIImageView *)imageView {
  55. if (!_imageView) {
  56. _imageView = [UIImageView new];
  57. _imageView.contentMode = UIViewContentModeScaleAspectFit;
  58. }
  59. return _imageView;
  60. }
  61. - (UILabel *)titleLabel {
  62. if (!_titleLabel) {
  63. _titleLabel = [UILabel new];
  64. _titleLabel.textColor = UIColorFromRGB(0x666666);
  65. _titleLabel.font = [UIFont systemFontOfSize:12];
  66. _titleLabel.textAlignment = NSTextAlignmentCenter;
  67. }
  68. return _titleLabel;
  69. }
  70. - (UILabel *)priceLabel {
  71. if (!_priceLabel) {
  72. _priceLabel = [UILabel new];
  73. _priceLabel.textColor = UIColorFromRGB(0xff624a);
  74. _priceLabel.textAlignment = NSTextAlignmentCenter;
  75. }
  76. return _priceLabel;
  77. }
  78. @end