No Description

FKSubmitDiscountView.m 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. //
  2. // FKSubmitDiscountView.m
  3. // FirstLink
  4. //
  5. // Created by ascii on 15/11/10.
  6. // Copyright © 2015年 FirstLink. All rights reserved.
  7. //
  8. #import "FKSubmitDiscountView.h"
  9. @interface FKSubmitDiscountView ()
  10. @property (nonatomic, strong) UIImageView *iconView;
  11. @end
  12. @implementation FKSubmitDiscountView
  13. /*
  14. // Only override drawRect: if you perform custom drawing.
  15. // An empty implementation adversely affects performance during animation.
  16. - (void)drawRect:(CGRect)rect {
  17. // Drawing code
  18. }
  19. */
  20. - (instancetype)initWithFrame:(CGRect)frame {
  21. self = [super initWithFrame:frame];
  22. if (self) {
  23. self.backgroundColor = UIColorFromRGB(0xdcbe9c);
  24. [self addAllSubviews];
  25. }
  26. return self;
  27. }
  28. #pragma mark - Layout
  29. - (void)addAllSubviews {
  30. [self addSubview:self.textLabel];
  31. [self.textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  32. make.centerY.equalTo(self);
  33. make.centerX.equalTo(self);
  34. }];
  35. [self addSubview:self.iconView];
  36. [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
  37. make.right.equalTo(self.textLabel.mas_left).with.offset(-7);
  38. make.centerY.equalTo(self.textLabel);
  39. }];
  40. }
  41. #pragma mark - Property
  42. - (UILabel *)textLabel {
  43. if (!_textLabel) {
  44. _textLabel = [[UILabel alloc] init];
  45. _textLabel.textColor = UIColorFromRGB(0xffffff);
  46. _textLabel.backgroundColor = [UIColor clearColor];
  47. _textLabel.font = [UIFont systemFontOfSize:13];
  48. }
  49. return _textLabel;
  50. }
  51. - (UIImageView *)iconView {
  52. if (!_iconView) {
  53. _iconView = [[UIImageView alloc] init];
  54. _iconView.image = [UIImage imageNamed:@"ActivityDiscountIcon"];
  55. }
  56. return _iconView;
  57. }
  58. @end