struct CGRect中没有名为'frame'的成员

时间:2012-09-18 03:59:09

标签: frame cgrect

我在struct CGRect中收到错误“没有名为'frame'的成员”。

    UITouch *touch = [[event2 allTouches] anyObject];
CGPoint touchlocation = [touch locationInView:self.view];
if ( CGRectContainsPoint( enemy.frame, touchlocation ) ) {
    MedalGo = 0;
    // inside imgView
} else {
    // outside imgView Now we will found out is it within proximityImgViewRect
    CGRect proximityImgViewRect = CGRectMake( enemy.frame.origin.x-25,enemy.frame.origin.y - 25, enemy.frame.size.width+50,enemy.frame.size.height+50);
    if ( CGRectContainsPoint( proximityImgViewRect.frame, touchlocation ) ) {
        // inside proximityImgViewRect
        MedalGo = 1;

    } else {
        //outside proximityImgViewRect
        MedalGo = 0;
    }
}

任何帮助将不胜感激。谢谢。

1 个答案:

答案 0 :(得分:2)

CGRect是框架。

 if ( CGRectContainsPoint( proximityImgViewRect.frame, touchlocation ) )

没有

 if ( CGRectContainsPoint( proximityImgViewRect, touchlocation ) )