SettingsItemView.m 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // SettingsItemView.m
  3. // 千模
  4. //
  5. // Created by Drew on 2018/10/27.
  6. // Copyright © 2018年 MUMEI. All rights reserved.
  7. //
  8. #import "SettingsItemView.h"
  9. @interface SettingsItemView()
  10. @property (weak, nonatomic) IBOutlet UILabel *labelView;
  11. @property (weak, nonatomic) IBOutlet UIView *line;
  12. @end
  13. @implementation SettingsItemView
  14. - (instancetype)initWithFrame:(CGRect)frame {
  15. if (self = [super initWithFrame:frame]) {
  16. [self initView];
  17. }
  18. return self;
  19. }
  20. - (instancetype)initWithCoder:(NSCoder *)aDecoder {
  21. if (self = [super initWithCoder:aDecoder]) {
  22. [self initView];
  23. }
  24. return self;
  25. }
  26. - (void)initView {
  27. NSBundle *bundle = [NSBundle bundleForClass:[self class]];
  28. NSString *className = NSStringFromClass([self class]);
  29. UIView *view = [[bundle loadNibNamed:className owner:self options:nil] firstObject];
  30. view.frame = self.bounds;
  31. [self addSubview:view];
  32. }
  33. -(void)setLabel:(NSString *)label{
  34. self.labelView.text = label;
  35. }
  36. -(void)setShowLine:(BOOL)showLine{
  37. self.line.hidden = !showLine;
  38. }
  39. /*
  40. // Only override drawRect: if you perform custom drawing.
  41. // An empty implementation adversely affects performance during animation.
  42. - (void)drawRect:(CGRect)rect {
  43. // Drawing code
  44. }
  45. */
  46. @end