RASettingSwitchCell.m 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // RASettingSwitchCell.m
  3. // Apex And Drivers
  4. //
  5. // Created by Jack on 2018/9/12.
  6. // Copyright © 2018年 USAI. All rights reserved.
  7. //
  8. #import "RASettingSwitchCell.h"
  9. #import "RASettingSwitchModel.h"
  10. @interface RASettingSwitchCell ()
  11. @property (nonatomic,strong) IBOutlet UILabel *titleLabel;
  12. @property (nonatomic,strong) IBOutlet UISwitch *switchBtn;
  13. @end
  14. @implementation RASettingSwitchCell
  15. - (void)awakeFromNib {
  16. [super awakeFromNib];
  17. // Initialization code
  18. }
  19. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  20. [super setSelected:selected animated:animated];
  21. // Configure the view for the selected state
  22. }
  23. - (void)refreshUI {
  24. RASettingSwitchModel *model = (RASettingSwitchModel *)self.model;
  25. NSString *title = model.title;
  26. BOOL switchValue = model.switchValue;
  27. self.titleLabel.text = title;
  28. self.switchBtn.on = switchValue;
  29. }
  30. - (IBAction)switchBtnClick:(UISwitch *)sender {
  31. RASettingSwitchModel *model = (RASettingSwitchModel *)self.model;
  32. model.switchValue = sender.isOn;
  33. }
  34. @end