"사자"를 찾고이 예와 같이 "단어를 찾을 수 있습니다"레이블 텍스트를 얻을 수있는 touchesMoved한 번만
GHKJLDFGFYE
JLMN LION ADT
GFOIAFEADGH
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
[self touchesBegan:touches withEvent:event];
UITouch *touch = [[event allTouches] anyObject];
CGPoint touchPoint = [[touches anyObject] locationInView:allLetters];
for (UILabel *letter in self.lettersArray) {
if (touchPoint.x > letter.frame.origin.x &&
touchPoint.x < letter.frame.origin.x + letter.frame.size.width &&
touchPoint.y > letter.frame.origin.y &&
touchPoint.y < letter.frame.origin.y + letter.frame.size.height)
{
[letter setBackgroundColor:[UIColor redColor]];
NSLog(@"%@",letter.text);
}
}}
손가락으로 터치하면 레이블 텍스트가 올바르게 표시되기 때문에 제대로 작동합니다. 당신이 어떤 조언을해야합니까 다른 편지
에 전달 될 때까지 내 문제는
지금은 값을 가져옵니다 ... 내가 한 번만 가치를 얻을 필요가 많은 몇 번입니까?
정말 고마워요 !!
와우! 고마워 친구! 그건 완벽합니다 ... 나는 if 문을 Y에 추가합니다. –