uiimageView碰撞检测的问题

时间:2011-08-30 22:17:09

标签: iphone xcode animation collision-detection intersection

这是我的代码:

-(void)moveTheImage
{
    for (NSUInteger i = 0; i < [views count]; 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;
        }
    }
}

我的问题是“imageView.alpha = 0.5”不起作用。我不知道为什么?

0 个答案:

没有答案