problem with uiimageView collision detection
here is my code:
-(void)moveTheImage
{
for (NSUInteger i = 0; i < [views cou开发者_JAVA百科nt]; i++)
{
imageView = [views objectAtIndex:i];
X = [[XArray objectAtIndex:i] floatValue];
Y = [[YArray objectAtIndex:i] floatValue];
imageView.center=CGPointMake(imageView.center.x + X, imageView.center.y + Y);
}
if(!intersectFlag)
{
if(CGRectIntersectsRect(imageView.frame,centre.frame))
{
imageView.alpha=0.5;
intersectFlag = YES;
++count;
}
}
else
{
if(!CGRectIntersectsRect(imageView.frame,centre.frame))
{
intersectFlag = NO;
}
}
}
My problem is that "imageView.alpha=0.5" doesn't work.I don't know why ?
精彩评论