Nav apraksta

FKVipBuyGuideButton.m 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //
  2. // FKVipBuyGuideButton.m
  3. // FirstLink
  4. //
  5. // Created by ascii on 2017/5/25.
  6. // Copyright © 2017年 FirstLink. All rights reserved.
  7. //
  8. #import "FKVipBuyGuideButton.h"
  9. @interface FKVipBuyGuideButton ()
  10. @property (nonatomic, strong) UIImageView *imgView;
  11. @property (nonatomic, strong) UILabel *vipLabel;
  12. @end
  13. @implementation FKVipBuyGuideButton
  14. /*
  15. // Only override drawRect: if you perform custom drawing.
  16. // An empty implementation adversely affects performance during animation.
  17. - (void)drawRect:(CGRect)rect {
  18. // Drawing code
  19. }
  20. */
  21. - (instancetype)initWithFrame:(CGRect)frame {
  22. self = [super initWithFrame:frame];
  23. [self addSubview:self.imgView];
  24. [self.imgView mas_makeConstraints:^(MASConstraintMaker *make) {
  25. make.left.equalTo(self).offset(6);
  26. make.centerY.equalTo(self);
  27. make.size.mas_equalTo(CGSizeMake(12, 12));
  28. }];
  29. [self addSubview:self.vipLabel];
  30. [self.vipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  31. make.left.equalTo(self.imgView.mas_right).offset(5);
  32. make.centerY.equalTo(self).offset(-2);
  33. }];
  34. UIView *line = [UIView new];
  35. line.backgroundColor = UIColorFromRGB(0xff6362);
  36. [self addSubview:line];
  37. [line mas_makeConstraints:^(MASConstraintMaker *make) {
  38. make.left.right.equalTo(self.vipLabel);
  39. make.top.equalTo(self.vipLabel.mas_bottom).offset(2);
  40. make.height.mas_equalTo(1.0/[UIScreen mainScreen].scale);
  41. }];
  42. return self;
  43. }
  44. #pragma mark - Property
  45. - (UIImageView *)imgView{
  46. if (_imgView == nil) {
  47. _imgView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"CouponQuestionIcon"]];
  48. }
  49. return _imgView;
  50. }
  51. - (UILabel *)vipLabel {
  52. if (_vipLabel == nil) {
  53. _vipLabel = [[UILabel alloc]init];
  54. _vipLabel.textColor = UIColorFromRGB(0xff6362);
  55. _vipLabel.font = [UIFont boldSystemFontOfSize:9];
  56. _vipLabel.text = @"购买VIP";
  57. }
  58. return _vipLabel;
  59. }
  60. @end