本文主要是介绍iOS在UIView遮罩层上截取一块透明区域(新手引导页),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
用于设置新手引导页
设置方法
- (CAShapeLayer *)addTransparencyViewWith:(UIBezierPath *)tempPath{UIBezierPath *path = [UIBezierPath bezierPathWithRect:[UIScreen mainScreen].bounds];[path appendPath:tempPath];path.usesEvenOddFillRule = YES;CAShapeLayer *shapeLayer = [CAShapeLayer layer];shapeLayer.path = path.CGPath;shapeLayer.fillColor= [UIColor blackColor].CGColor; //其他颜色都可以,只要不是透明的shapeLayer.fillRule=kCAFillRuleEvenOdd;return shapeLayer;
}
使用方法:
UIBezierPath *tempPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(120, 150, 100, 50)
这篇关于iOS在UIView遮罩层上截取一块透明区域(新手引导页)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!