title: xcode two images intersects before they actually touch
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/5926355/problem-with-collision-of-two-images">problem with collision of two images</a>  </p>
  </blockquote>
  
  
  
  <p>HI everyone I'm french so scuse me for my english: SO I have two images(flakeView and viewToRotate) one that is moving, the other static in the center of the screen.What I want is : if flakeView and viewToRotate collide : do something. But the problem is that they intersects before they actually touch and  I don't know where is the problem.
  here is the code:</p>
  
  <pre><code>UIImageView *flakeView = [[UIImageView alloc] initWithImage:flakeImage];
  
  // use the random() function to randomize up our flake attributes
  int startX = round(random() % 480);
  
  
  
  
  // set the flake start position
  flakeView.center = CGPointMake(startX, -20.0);
  flakeView.alpha = 1;
  
  CGRect frame = CGRectMake(startX, -20.0, 30, 30);
  flakeView.frame = frame;
  
  // put the flake in our main view
  [self.view addSubview:flakeView];
  
  [UIView beginAnimations:nil context:flakeView];
  // set up how fast the flake will fall
  [UIView setAnimationDuration:7 ];
  
  // set the postion where flake will move to
  flakeView.center = viewToRotate.center;
  
  // set a stop callback so we can cleanup the flake when it reaches the
  // end of its animation
  [UIView setAnimationDelegate:self];
  [UIView commitAnimations];
  if (CGRectIntersectsRect(flakeView.frame, viewToRotate.frame) == 1){
      //do something
  }
  </code></pre>
  
  <p>}</p>
  
  <p>How can I solve this please ?</p>