我在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;
}
}
任何帮助将不胜感激。谢谢。
答案 0 :(得分:2)
CGRect是框架。
if ( CGRectContainsPoint( proximityImgViewRect.frame, touchlocation ) )
没有
if ( CGRectContainsPoint( proximityImgViewRect, touchlocation ) )
是