0
的错误我有一个代码,但在这段代码有错误,我不知道为什么我有这个错误。 因为我希望我的球击中至少边境大豆屏幕我把这个代码。 你可以看到我的代码:如何纠正这一计划
CGPoint ballCenter = ball.center;
CGRect ballRect = CGRectMake(50, 73, 50, 50); // an arbitrary location for the ball, you would normally use the frame property of the ball here
CGRect s = [UIScreen mainScreen].bounds;
CGRect adjustedScreenRect = CGRectMake(s.x-50 // take the ball's (width or height) and divide it by two to get the distance to the center. Then multiply it by two and subtract from the appropriate dimension(x offset (width), y offset (height), width (width), height (height)).
BOOL isOnScreen = CGRectContainsPoint(adjutedScreenRect, ballCenter);
// do whatever with the BOOL from the above line...
我有一个错误在这行:
CGRect adjustedScreenRect = CGRectMake(s.x-50 // take the ball's (width or height) and divide it by two to get the distance to the center. Then multiply it by two and subtract from the appropriate dimension(x offset (width), y offset (height), width (width), height (height)).
BOOL isOnScreen = CGRectContainsPoint(adjutedScreenRect, ballCenter);
和错误是X“在结构的CGRect‘’没有名为成员”。
感谢您的帮助
答案是CGRect adjustedScreenRect = CGRectMake(s.origin.x-50
BOOL isOnScreen = CGRectContainsPoint(adjutedScreenRect, ballCenter);
但我有BOOL预期的错误)。
你能帮我
是的,就是我刚才说的。 – 2012-04-22 18:50:14
我有“预期)”错误与BOOL – AddGame 2012-04-22 19:29:28
编辑与问题的代码行你的帖子,我会看看我能做些什么。 – CodaFi 2012-04-22 19:31:52