0

我收到错误“结构 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;
    }
}

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

4

1 回答 1

2

CGRect 是框架。

 if ( CGRectContainsPoint( proximityImgViewRect.frame, touchlocation ) )

 if ( CGRectContainsPoint( proximityImgViewRect, touchlocation ) )

是的

于 2012-09-18T04:03:21.117 回答