ZYBaseWindow.m 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //
  2. // ZYBaseWindow.m
  3. // VQU
  4. //
  5. // Created by Elaine on 2021/1/9.
  6. // Copyright © 2021 leo. All rights reserved.
  7. //
  8. #import "ZYBaseWindow.h"
  9. @interface ZYBaseWindow ()
  10. @end
  11. @implementation ZYBaseWindow
  12. - (void)viewDidLoad {
  13. [super viewDidLoad];
  14. [self.view setBackgroundColor:[UIColor clearColor]];
  15. UIView *baseView = [[UIView alloc] initWithFrame:CGRectMake(0, 0,_vWidth, _vHeight)];
  16. baseView.center = self.view.center;
  17. baseView.backgroundColor = [UIColor whiteColor];
  18. [self.view addSubview:baseView];
  19. CAShapeLayer *maskLayer = [CAShapeLayer layer];
  20. UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:baseView.bounds cornerRadius:10.0f];
  21. maskLayer.path = path.CGPath;
  22. baseView.layer.mask = maskLayer;
  23. self.baseView = baseView;
  24. }
  25. - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
  26. UITouch *touch = [touches.allObjects lastObject];
  27. if (touch.view == self.view && self.isTouchDismiss) {
  28. [self dismissViewControllerAnimated:YES completion:nil];
  29. }
  30. }
  31. @end