MORedBaseView.m 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //
  2. // MORedBaseView.m
  3. // MiMoLive
  4. //
  5. // Created by SuperC on 2025/8/28.
  6. //
  7. #import "MORedBaseView.h"
  8. #import "UIView+MOCornerRadius.h"
  9. @interface MORedBaseView ()
  10. @end
  11. @implementation MORedBaseView
  12. - (instancetype)init {
  13. if (self = [super init] ) {
  14. [self setupUI];
  15. }
  16. return self;
  17. }
  18. - (instancetype)initWithFrame:(CGRect)frame{
  19. self = [super initWithFrame:frame];
  20. if (self){
  21. [self setupUI];
  22. }
  23. return self;
  24. }
  25. - (void)setupUI{
  26. [self addSubview:self.lianMaiRedLab];
  27. [self.lianMaiRedLab mas_makeConstraints:^(MASConstraintMaker *make) {
  28. make.edges.equalTo(self);
  29. }];
  30. }
  31. - (void)layoutSubviews {
  32. [super layoutSubviews];
  33. [self.lianMaiRedLab setCornerRadiusWithTopLeft:12.0
  34. topRight:12.0
  35. bottomRight:12.0
  36. bottomLeft:4.0];
  37. }
  38. - (UILabel *)lianMaiRedLab{
  39. if(!_lianMaiRedLab){
  40. _lianMaiRedLab = [[UILabel alloc] init];
  41. _lianMaiRedLab.font = [MOTextTools mediumFont:14.0];
  42. _lianMaiRedLab.textColor = [MOTools colorWithHexString:@"#FFFFFF" alpha:1.0];
  43. _lianMaiRedLab.textAlignment = NSTextAlignmentCenter;
  44. _lianMaiRedLab.backgroundColor = [MOTools colorWithHexString:@"#FD3B3B"];
  45. }
  46. return _lianMaiRedLab;
  47. }
  48. @end