YMCancellationAccountViewController.m 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. //
  2. // YMCancellationAccountViewController.m
  3. // MSYOUPAI
  4. //
  5. // Created by YoMi on 2024/3/17.
  6. // Copyright © 2024 MS. All rights reserved.
  7. //
  8. #import "YMCancellationAccountViewController.h"
  9. #import "YMCancellationAccountViewModel.h"
  10. #import "YMCancellationAccountInfoView.h"
  11. @interface YMCancellationAccountViewController ()<UIGestureRecognizerDelegate>
  12. /// 注销账号VM
  13. @property (nonatomic, strong) YMCancellationAccountViewModel *viewModel;
  14. /// 容器滚动视图
  15. @property (nonatomic, strong) UIScrollView *contentScrollView;
  16. /// 容器视图
  17. @property (nonatomic, strong) UIView *contentView;
  18. /// 注销账号信息视图
  19. @property (nonatomic, strong) YMCancellationAccountInfoView *cancellationAccountInfoView;
  20. @end
  21. @implementation YMCancellationAccountViewController
  22. @dynamic viewModel;
  23. - (void)viewDidLoad {
  24. [super viewDidLoad];
  25. }
  26. - (void)ym_setupViews{
  27. [self.view addSubview:self.contentScrollView];
  28. [self.contentScrollView addSubview:self.contentView];
  29. [self.contentView addSubview:self.cancellationAccountInfoView];
  30. [self.view setNeedsUpdateConstraints];
  31. [self.view updateConstraintsIfNeeded];
  32. }
  33. - (void)updateViewConstraints{
  34. [self.contentScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
  35. make.top.equalTo(self.view).offset(kYMNavHeight);
  36. make.left.equalTo(self.view);
  37. make.right.equalTo(self.view);
  38. make.bottom.equalTo(self.view);
  39. }];
  40. [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
  41. make.edges.equalTo(self.contentScrollView);
  42. make.width.equalTo(self.contentScrollView.mas_width);
  43. }];
  44. [self.cancellationAccountInfoView mas_makeConstraints:^(MASConstraintMaker *make) {
  45. make.top.equalTo(self.contentView);
  46. make.left.equalTo(self.contentView);
  47. make.right.equalTo(self.contentView);
  48. make.bottom.equalTo(self.contentView);
  49. }];
  50. [super updateViewConstraints];
  51. }
  52. - (void)ym_bindViewModel{
  53. [self.cancellationAccountInfoView ym_bindViewModel:self.viewModel];
  54. }
  55. - (UIScrollView *)contentScrollView{
  56. if (!_contentScrollView) {
  57. _contentScrollView = [[UIScrollView alloc]init];
  58. _contentScrollView.alwaysBounceVertical = YES;
  59. _contentScrollView.showsVerticalScrollIndicator = NO;
  60. _contentScrollView.showsHorizontalScrollIndicator = NO;
  61. _contentScrollView.backgroundColor = UIColor.clearColor;
  62. _contentScrollView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
  63. }
  64. return _contentScrollView;
  65. }
  66. - (UIView *)contentView{
  67. if (!_contentView) {
  68. _contentView = [[UIView alloc]init];
  69. }
  70. return _contentView;
  71. }
  72. - (YMCancellationAccountInfoView *)cancellationAccountInfoView{
  73. if (!_cancellationAccountInfoView) {
  74. _cancellationAccountInfoView = [[YMCancellationAccountInfoView alloc]init];
  75. }
  76. return _cancellationAccountInfoView;
  77. }
  78. @end