1
我不明白爲什麼一個CAShapeLayer並不則hitTestCAShapeLayer則hitTest觸摸
迴應此功能總是轉到//觸摸超出
如何檢測在CAShapeLayer觸摸?
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { currentPoint = [[touches anyObject] locationInView:self]; for (CAShapeLayer *layer in self.layer.sublayers) { if(layer == shapeLayer) { if([layer hitTest:currentPoint]) { // touche is on the layer } else { // touche is outside } } } }
效果很好。感謝分享!。 – Vignesh 2011-10-11 04:37:58