grardButton.m 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //
  2. // grardButton.m
  3. // yunbaolive
  4. //
  5. // Created by Boom on 2018/11/8.
  6. // Copyright © 2018年 cat. All rights reserved.
  7. //
  8. #import "grardButton.h"
  9. @implementation grardButton
  10. - (instancetype)initWithFrame:(CGRect)frame{
  11. self = [super initWithFrame:frame];
  12. self.frame = frame;
  13. if (self) {
  14. self.nameL = [[UILabel alloc]init];
  15. _nameL.textColor = RGB_COLOR(@"#959697", 1);
  16. _nameL.font = [UIFont systemFontOfSize:12];
  17. _nameL.textAlignment = NSTextAlignmentCenter;
  18. _nameL.userInteractionEnabled = NO;
  19. [self addSubview:_nameL];
  20. [_nameL mas_makeConstraints:^(MASConstraintMaker *make) {
  21. make.top.equalTo(self).offset(8);
  22. make.left.right.equalTo(self);
  23. make.height.equalTo(self).multipliedBy(0.3);
  24. }];
  25. UIView *view = [[UIView alloc]init];
  26. view.userInteractionEnabled = NO;
  27. [self addSubview:view];
  28. [view mas_makeConstraints:^(MASConstraintMaker *make) {
  29. make.top.equalTo(_nameL.mas_bottom);
  30. make.bottom.left.right.equalTo(self);
  31. }];
  32. self.coinL = [[UILabel alloc]init];
  33. _coinL.textColor = Pink_Cor;
  34. _coinL.font = [UIFont systemFontOfSize:12];
  35. _coinL.textAlignment = NSTextAlignmentCenter;
  36. _coinL.text = @"0";
  37. [view addSubview:_coinL];
  38. [_coinL mas_makeConstraints:^(MASConstraintMaker *make) {
  39. make.top.equalTo(view);
  40. make.centerX.equalTo(view).offset(6);
  41. make.height.equalTo(view).multipliedBy(0.7);
  42. }];
  43. UIImageView *zunashiImgView = [[UIImageView alloc]init];
  44. zunashiImgView.image = [UIImage imageNamed:@"logFirst_钻石.png"];
  45. [view addSubview:zunashiImgView];
  46. [zunashiImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  47. make.centerY.equalTo(_coinL);
  48. make.width.height.mas_equalTo(11);
  49. make.right.equalTo(_coinL.mas_left).offset (-2);
  50. }];
  51. }
  52. return self;
  53. }
  54. @end