DemoPasswordItem.m 1004 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // DemoPasswordItem.m
  3. // xh_textfield
  4. //
  5. // Created by 路 on 2019/11/8.
  6. // Copyright © 2019年 路. All rights reserved.
  7. //
  8. #import "DemoPasswordItem.h"
  9. @implementation DemoPasswordItem {
  10. UIView *_blackPointView;
  11. }
  12. - (id)init; {
  13. self = [super init];
  14. if (self) {
  15. self.backgroundColor = [UIColor whiteColor];
  16. _blackPointView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
  17. _blackPointView.backgroundColor = [UIColor blackColor];
  18. _blackPointView.layer.cornerRadius = _blackPointView.frame.size.height * .5;
  19. _blackPointView.layer.masksToBounds = YES;
  20. _blackPointView.hidden = YES;
  21. [self addSubview:_blackPointView];
  22. } return self;
  23. }
  24. - (void)layoutSubviews; {
  25. [super layoutSubviews];
  26. _blackPointView.center = CGPointMake(self.frame.size.width * .5, self.frame.size.height * .5);
  27. }
  28. - (void)setText:(NSString *)text; {
  29. [super setText:text];
  30. _blackPointView.hidden = (text == nil);
  31. }
  32. @end