No Description

LogisticsQuestionCell.m 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //
  2. // LogisticsQuestionCell.m
  3. // FirstLink
  4. //
  5. // Created by ascii on 16/1/14.
  6. // Copyright © 2016年 FirstLink. All rights reserved.
  7. //
  8. #import "LogisticsQuestionCell.h"
  9. @interface LogisticsQuestionCell ()
  10. @property (nonatomic, strong) UILabel *titleLabel;
  11. @end
  12. @implementation LogisticsQuestionCell
  13. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  14. self = [super initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:reuseIdentifier];
  15. if (self) {
  16. [self addAllSubViews];
  17. }
  18. return self;
  19. }
  20. - (void)addAllSubViews {
  21. [self.contentView addSubview:self.iconButton];
  22. [self.iconButton mas_makeConstraints:^(MASConstraintMaker *make) {
  23. make.centerX.equalTo(self.contentView);
  24. make.top.equalTo(self.contentView).with.offset(120);
  25. }];
  26. [self.contentView addSubview:self.titleLabel];
  27. [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  28. make.top.equalTo(self.iconButton.mas_bottom).offset(7);
  29. make.centerX.equalTo(self.contentView);
  30. }];
  31. }
  32. #pragma mark - Property
  33. - (UIButton *)iconButton {
  34. if (!_iconButton) {
  35. _iconButton = [UIButton buttonWithType:UIButtonTypeCustom];
  36. [_iconButton setBackgroundImage:[UIImage imageNamed:@"LogisticsQuestionIcon"] forState:UIControlStateNormal];
  37. }
  38. return _iconButton;
  39. }
  40. - (UILabel *)titleLabel {
  41. if (!_titleLabel) {
  42. _titleLabel = [UILabel new];
  43. _titleLabel.font = [UIFont systemFontOfSize:14];
  44. _titleLabel.textAlignment = NSTextAlignmentCenter;
  45. _titleLabel.textColor = UIColorFromRGB(0xcccccc);
  46. _titleLabel.text = @"物流说明";
  47. }
  48. return _titleLabel;
  49. }
  50. @end