Няма описание

FKVipPrivilegeCollectionCell.m 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. //
  2. // FKVipPrivilegeCollectionCell.m
  3. // FirstLink
  4. //
  5. // Created by ascii on 2017/5/15.
  6. // Copyright © 2017年 FirstLink. All rights reserved.
  7. //
  8. #import "FKVipPrivilegeCollectionCell.h"
  9. NSString *const kVipFreePostageKey = @"kVipFreePostageKey";
  10. @interface FKVipPrivilegeCollectionCell ()
  11. @property (nonatomic, strong, readwrite) UIImageView *imgView;
  12. @property (nonatomic, strong, readwrite) UILabel *titleLabel;
  13. @property (nonatomic, strong, readwrite) UIImageView *lockImgView;
  14. @property (nonatomic, strong, readwrite) UIImageView *futureImgView;
  15. @end
  16. @implementation FKVipPrivilegeCollectionCell
  17. - (instancetype)initWithFrame:(CGRect)frame {
  18. self = [super initWithFrame:frame];
  19. if (self) {
  20. [self setupViews];
  21. }
  22. return self;
  23. }
  24. #pragma mark - Method
  25. - (void)setupViews {
  26. [self addSubview:self.imgView];
  27. [self.imgView mas_makeConstraints:^(MASConstraintMaker *make) {
  28. make.centerX.equalTo(self);
  29. make.size.mas_equalTo(CGSizeMake(45, 45));
  30. make.top.mas_equalTo(self).offset(10);
  31. }];
  32. [self addSubview:self.titleLabel];
  33. [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  34. make.centerX.equalTo(self.imgView);
  35. make.top.mas_equalTo(self.imgView.mas_bottom).offset(10);
  36. }];
  37. [self addSubview:self.lockImgView];
  38. [self.lockImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  39. make.left.equalTo(self.imgView.mas_centerX).offset(16);
  40. make.top.equalTo(self.imgView.mas_centerY).offset(8);
  41. }];
  42. [self addSubview:self.futureImgView];
  43. [self.futureImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  44. make.left.equalTo(self.imgView.mas_centerX).offset(20);
  45. make.centerY.equalTo(self.titleLabel.mas_centerY).offset(-1);
  46. }];
  47. }
  48. #pragma mark - Property
  49. - (UIImageView *)imgView {
  50. if (!_imgView) {
  51. _imgView = [UIImageView new];
  52. }
  53. return _imgView;
  54. }
  55. - (UILabel *)titleLabel {
  56. if (!_titleLabel) {
  57. _titleLabel = [[UILabel alloc] init];
  58. _titleLabel.font = [UIFont systemFontOfSize:12];
  59. _titleLabel.textColor = UIColorFromRGB(0x333333);
  60. }
  61. return _titleLabel;
  62. }
  63. - (UIImageView *)lockImgView {
  64. if (!_lockImgView) {
  65. _lockImgView = [UIImageView new];
  66. _lockImgView.image = [UIImage imageNamed:@"vip_lock_icon"];
  67. _lockImgView.hidden = YES;
  68. }
  69. return _lockImgView;
  70. }
  71. - (UIImageView *)futureImgView {
  72. if (!_futureImgView) {
  73. _futureImgView = [UIImageView new];
  74. _futureImgView.image = [UIImage imageNamed:@"vip_future_icon"];
  75. _futureImgView.hidden = YES;
  76. }
  77. return _futureImgView;
  78. }
  79. @end