OK我知道了:
NSUInteger touchCount = 0;
for (UITouch *touch in touches) {
if(numTaps >= 2) {
CGPoint touchPoint = [touch locationInView:self];
if (CGRectContainsPoint([firstTapView frame], touchPoint)) {
firstTapView.text = [NSString stringWithFormat:@"%d",numTaps];
} else if (CGRectContainsPoint([secondTapView frame], touchPoint)) {
secondTapView.text = [NSString stringWithFormat:@"%d",numTaps];
} else if (CGRectContainsPoint([thirdTapView frame], touchPoint)) {
thirdTapView.text = [NSString stringWithFormat:@"%d",numTaps];
}
}
touchCount++;
}
其中firstTapView,secondTapView和thirdTapView是我UILabels,顯示在屏幕上。觸摸示例使用UIImageView,但我將其更改爲UILabel,所以我可以在觸摸屏幕的同時進行書寫。
您可以檢測圖像內部的水龍頭嗎? – taskinoor 2011-01-10 15:10:20