두 객체의 교차점을 찾는 중입니다. 기본 애니메이션 코드를 사용하여 두 이미지 1을 왼쪽으로 이동합니다 -> 오른쪽 & 이미지 2 양식 맨 아래 -> 맨 위. 길게 누르면 화면 (어디서나)에.xcode에서 애니메이션을 사용하는 동안 교차 된/교차하지 않는 두 객체를 찾는 방법은 무엇입니까?
두 가지 방법이 교차되어 있는지 확인하는 방법을 알려줄 수 있습니까? 두 가지가 교차 할 때 경고 만 표시하고 싶습니다. ----
PLZ 다른 경우 제안 : 여기
내 코드 ..
-(IBAction)gesture_action:(UILongPressGestureRecognizer *)gesture
{
if(gesture.state == UIGestureRecognizerStateBegan) {
[self first];
[self colide:gesture];
} else if(gesture.state == UIGestureRecognizerStateChanged) {
NSLog(@"middle");
} else if(gesture.state == UIGestureRecognizerStateEnded) {
NSLog(@"end”);
}
}
-(BOOL)dragIsOverTrash:(UILongPressGestureRecognizer *)gesture
{
CGPoint pointInTrash =[gesture locationInView:self.image1];
return [self.image1 pointInside:pointInTrash withEvent:nil];
}
-(void)colide:(UILongPressGestureRecognizer *)gesture
{
if ([self dragIsOverTrash:gesture]){
NSLog(@" hitted the cloud ");
} else {
NSLog(@" not hited ");
}
}
-(void)first
{
[UIView animateWithDuration:4
animations:^{
image2.frame=CGRectMake(106,5,108,128);
}
completion:nil];
[UIView animateWithDuration:5
animations:^{
image1.frame=CGRectMake(-250,25,240,128);
}
completion:nil];
}
내 결과입니다 내기 이 문제를 해결하기 위해 ... 시간을내어 주셔서 감사합니다. 귀하의 도움에 감사드립니다. :)
제발 당신은 실제 코드가 아닌 이미지를 추가 할 수 있습니다. – Popeye
@Popeye 여기 코드 http://pastie.org/8856832의 링크입니다 .. dealy buddy.can 당신이 나를 도울 수 있도록 ... –
이미지 또는 링크가 아닌 질문에 코드를 입력하십시오. . 링크가 만료 될 수 있습니다. – Popeye