我不明白为什么 CAShapeLayer 不响应 hitTest
这个函数总是去 // 触摸在外面
如何检测 CAShapeLayer 上的触摸?
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
currentPoint = [[touches anyObject] locationInView:self];
for (CAShapeLayer *layer in self.layer.sublayers) {
如果(层 == shapeLayer){
if([图层 hitTest:currentPoint])
{
// touche 在图层上
}
别的 {
// 触摸在外面
}
}
}
}