RoomPasswordView.m 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. //
  2. // RoomPasswordView.m
  3. // BuguLive
  4. //
  5. // Created by voidcat on 2024/5/20.
  6. // Copyright © 2024 xfg. All rights reserved.
  7. //
  8. #import "RoomPasswordView.h"
  9. @interface RoomPasswordView ()
  10. @end
  11. @implementation RoomPasswordView
  12. #pragma mark - LifeCycle
  13. - (void)dealloc {
  14. [self removeNotificationObserver];
  15. }
  16. - (void)awakeFromNib {
  17. [super awakeFromNib];
  18. //设置view
  19. [self setupView];
  20. //请求数据
  21. [self requestData];
  22. //设置通知
  23. [self addNotificationObserver];
  24. }
  25. #pragma mark - View
  26. - (void)setupView {
  27. self.labPassword.text = ASLocalizedString(@"输入密码");
  28. self.txtPassword.placeholder = ASLocalizedString(@"输入密码");
  29. self.txtPassword.placeholderColor = [UIColor colorWithHexString:@"#999999"];
  30. //设置UISwich 颜色
  31. self.swcPassword.onTintColor = [UIColor colorWithHexString:@"#CCCCCC"];
  32. self.swcPassword.tintColor = [UIColor colorWithHexString:@"#CCCCCC"];
  33. self.txtPassword.textInsets = UIEdgeInsetsMake(0, 10, 0, 10);
  34. ViewRadius(self.txtPassword, 10);
  35. //监听self.labPassword
  36. [self.txtPassword addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
  37. }
  38. - (void)textFieldDidChange:(UITextField *)textField
  39. {
  40. if(textField.text.length > 0)
  41. {
  42. self.swcPassword.on = YES;
  43. }
  44. else
  45. {
  46. self.swcPassword.on = NO;
  47. }
  48. }
  49. - (IBAction)swChanged:(UISwitch *)sender {
  50. if(!sender.on)
  51. {
  52. self.txtPassword.text = @"";
  53. }
  54. }
  55. #pragma mark - Network
  56. - (void)requestData {
  57. }
  58. #pragma mark- Delegate
  59. #pragma mark UITableDatasource & UITableviewDelegate
  60. #pragma mark - Private
  61. #pragma mark - Event
  62. #pragma mark - Public
  63. #pragma mark - NSNotificationCenter
  64. - (void)addNotificationObserver {
  65. }
  66. - (void)removeNotificationObserver {
  67. }
  68. #pragma mark - Setter
  69. #pragma mark - Getter
  70. @end