首先在一個view上扣出一個區域,顯示下層view的方法
UIView *v1 = [[UIViewalloc]initWithFrame:self.view.bounds];
[v1 setBackgroundColor:[UIColorblackColor]];
[v1setAlpha:0.8f];
[self.viewaddSubview:v1];
//通過貝賽爾曲線來切出這個口
UIBezierPath *path = [UIBezierPathbezierPathWithRect:CGRectMake(0,0,self.pageSize.width,self.pageSize.height)];
[path appendPath:[[UIBezierPathbezierPathWithRoundedRect:self.rectangleRectcornerRadius:1]bezierPathByReversingPath ]];
CAShapeLayer *shapeLayer = [CAShapeLayerlayer];
shapeLayer.path = path.CGPath;
[v1.layersetMask:shapeLayer];
注:這段代碼實現了當中的框。其他請先無視。