XLDot.m 857 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //
  2. // XLDot.m
  3. // XLDotLoadingDemo
  4. //
  5. // Created by Apple on 2017/1/28.
  6. // Copyright © 2017年 Apple. All rights reserved.
  7. //
  8. #import "XLDot.h"
  9. @interface XLDot ()
  10. {
  11. UILabel *_label;
  12. }
  13. @end
  14. @implementation XLDot
  15. -(instancetype)initWithFrame:(CGRect)frame
  16. {
  17. if (self = [super initWithFrame:frame]) {
  18. [self buildUI];
  19. }
  20. return self;
  21. }
  22. -(void)buildUI
  23. {
  24. self.layer.cornerRadius = self.bounds.size.width/2.0f;
  25. self.layer.masksToBounds = true;
  26. _label = [[UILabel alloc] initWithFrame:self.bounds];
  27. _label.textAlignment = NSTextAlignmentCenter;
  28. _label.font = [UIFont boldSystemFontOfSize:20];
  29. _label.text = @"";
  30. _label.adjustsFontSizeToFitWidth = true;
  31. [self addSubview:_label];
  32. }
  33. -(void)setTextColor:(UIColor *)textColor
  34. {
  35. _textColor = textColor;
  36. _label.textColor = textColor;
  37. }
  38. @end