YMBaseView.m 782 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // YMBaseView.m
  3. // MSYOUPAI
  4. //
  5. // Created by YoMi on 2024/2/4.
  6. // Copyright © 2024 MS. All rights reserved.
  7. //
  8. #import "YMBaseView.h"
  9. @implementation YMBaseView
  10. - (instancetype)init{
  11. if (self = [super init]) {
  12. [self ym_setupViews];
  13. }
  14. return self;
  15. }
  16. - (instancetype)initWithFrame:(CGRect)frame{
  17. if (self = [super initWithFrame:frame]) {
  18. [self ym_setupViews];
  19. }
  20. return self;
  21. }
  22. /** 添加控件 最好最后加上[self setNeedsUpdateConstraints]和[self updateConstraintsIfNeeded],以防不调用updateConstraints*/
  23. - (void)ym_setupViews {
  24. }
  25. /** 绑定VM*/
  26. - (void)ym_bindViewModel:(id)viewModel{
  27. }
  28. - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
  29. [self endEditing:YES];
  30. }
  31. @end