No Description

FKShareListCell.m 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. //
  2. // FKShareListCell.m
  3. // FirstLink
  4. //
  5. // Created by jack on 16/4/9.
  6. // Copyright © 2016年 FirstLink. All rights reserved.
  7. //
  8. #import "FKShareListCell.h"
  9. @implementation FKShareListCell
  10. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  11. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  12. [self addAllSubviews];
  13. self.selectionStyle = UITableViewCellSelectionStyleNone;
  14. }
  15. return self;
  16. }
  17. - (void)addAllSubviews{
  18. UIView *bottomLine = [[UIView alloc]init];
  19. bottomLine.backgroundColor = UIColorFromRGB(0xe5e5e5);
  20. [self.contentView addSubview:self.selectBtn];
  21. [self.contentView addSubview:self.imgView];
  22. [self.contentView addSubview:self.titleLabel];
  23. [self.contentView addSubview:bottomLine];
  24. [self.selectBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  25. make.left.equalTo(self.contentView);
  26. make.centerY.equalTo(self.contentView);
  27. make.size.mas_equalTo(CGSizeMake(48, 45));
  28. }];
  29. [self.imgView mas_makeConstraints:^(MASConstraintMaker *make) {
  30. make.left.equalTo(self.selectBtn.mas_right);
  31. make.centerY.equalTo(self.contentView);
  32. make.size.mas_equalTo(CGSizeMake([FKShareListCell imageViewMargin], [FKShareListCell imageViewMargin]));
  33. }];
  34. [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  35. make.left.equalTo(self.imgView.mas_right).offset(15);
  36. make.centerY.equalTo(self.imgView);
  37. make.right.equalTo(self.contentView).offset(- 15);
  38. }];
  39. [bottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
  40. make.left.equalTo(self.imgView);
  41. make.right.bottom.equalTo(self.contentView);
  42. make.height.mas_equalTo(0.5);
  43. }];
  44. }
  45. + (CGFloat)imageViewMargin{
  46. return 80;
  47. }
  48. #pragma mark - property
  49. - (UIButton *)selectBtn{
  50. if (_selectBtn == nil) {
  51. _selectBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  52. [_selectBtn setImage:[UIImage imageNamed:@"basket_unSelect"] forState:UIControlStateNormal];
  53. [_selectBtn setImage:[UIImage imageNamed:@"basket_selected"] forState:UIControlStateSelected];
  54. }
  55. return _selectBtn;
  56. }
  57. - (UILabel *)titleLabel{
  58. if (_titleLabel == nil) {
  59. if (_titleLabel == nil) {
  60. _titleLabel = [[UILabel alloc]init];
  61. _titleLabel.font = [UIFont systemFontOfSize:13];
  62. _titleLabel.textColor = UIColorFromRGB(0x333333);
  63. _titleLabel.numberOfLines = 2;
  64. }
  65. }
  66. return _titleLabel;
  67. }
  68. - (UIImageView *)imgView{
  69. if (_imgView == nil) {
  70. _imgView = [[UIImageView alloc]init];
  71. }
  72. return _imgView;
  73. }
  74. @end