CYMaskView.m 815 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. //
  2. // CYMaskView.m
  3. // BuguLive
  4. //
  5. // Created by 志刚杨 on 2021/1/6.
  6. // Copyright © 2021 xfg. All rights reserved.
  7. //
  8. #import "CYMaskView.h"
  9. @implementation CYMaskView
  10. - (instancetype)initWithFrame:(CGRect)frame
  11. {
  12. self = [super initWithFrame:frame];
  13. if (self) {
  14. // self.backgroundColor = kRedColor;
  15. self.hidden = YES;
  16. }
  17. return self;
  18. }
  19. -(void)addTo:(UIView *)supperView withView:(UIView *)view
  20. {
  21. self.frame = supperView.bounds;
  22. [supperView addSubview:self];
  23. [self addSubview:view];
  24. //添加手势
  25. UITapGestureRecognizer * tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGestureRecognizer)];
  26. [self addGestureRecognizer:tapGesture];
  27. }
  28. - (void)handleTapGestureRecognizer {
  29. self.hidden = YES;
  30. }
  31. @end