使用CALayer作为GLKView背衬层的掩模会阻止触摸事件?

时间:2012-06-10 19:52:56

标签: objective-c calayer cashapelayer

我正在尝试使用CAShapeLayer作为GLKView背衬层的掩码,如下所示:

CGRect circleFrame = CGRectMake(0, 0, 800, 800);
UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:circleFrame];
CGPoint circleAnchor = CGPointMake(CGRectGetMidX(circleFrame) / CGRectGetMaxX(circleFrame),CGRectGetMidY(circleFrame) / CGRectGetMaxY(circleFrame));

shapeLayerMask = [[CAShapeLayer alloc] init];
shapeLayerMask.path = path.CGPath;
shapeLayerMask.anchorPoint = circleAnchor;
shapeLayerMask.frame = CGRectMake(0, 0,800, 800);
shapeLayerMask.fillColor = [UIColor blackColor].CGColor;

shapeLayerMask.backgroundColor = [UIColor clearColor].CGColor;
shapeLayerMask.opacity = 1.0f;
shapeLayerMask.hidden = NO;

self.view.layer.mask = shapeLayerMask;

但是一旦我这样做,我的所有触摸事件都会停止发射。没有更多的接触开始,触摸,等等,任何人都知道为什么?提前谢谢!

0 个答案:

没有答案