// // ZYBaseWindow.m // VQU // // Created by Elaine on 2021/1/9. // Copyright © 2021 leo. All rights reserved. // #import "ZYBaseWindow.h" @interface ZYBaseWindow () @end @implementation ZYBaseWindow - (void)viewDidLoad { [super viewDidLoad]; [self.view setBackgroundColor:[UIColor clearColor]]; UIView *baseView = [[UIView alloc] initWithFrame:CGRectMake(0, 0,_vWidth, _vHeight)]; baseView.center = self.view.center; baseView.backgroundColor = [UIColor whiteColor]; [self.view addSubview:baseView]; CAShapeLayer *maskLayer = [CAShapeLayer layer]; UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:baseView.bounds cornerRadius:10.0f]; maskLayer.path = path.CGPath; baseView.layer.mask = maskLayer; self.baseView = baseView; } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *touch = [touches.allObjects lastObject]; if (touch.view == self.view && self.isTouchDismiss) { [self dismissViewControllerAnimated:YES completion:nil]; } } @end