使用 for 循环进行命中测试
我有 10 块砖块,每当我的球击中其中一块时,我就想移走那块砖块。 (打砖块)
这就是我尝试过
for (int bri=1; bri<11; bri++) {
// NSObject *brickimg = [NSObject stringWithFormat:@"brick%d", bri];
// if (CGRectIntersectsRect(ball.frame, brickimg.frame)) {
// [UIImageView stringWithFormat:@"brick%d", bri].hidden = YES;
// }
}
的,
UIImageView *brickimg = [UIImageView stringWithFormat:@"brick%d", bri];
但没有机会。 正确的语法是怎样的?
i have 10 bricks, whenever my ball hit one of them i want to remove that brick. (brick breaker)
That is what i tried
for (int bri=1; bri<11; bri++) {
// NSObject *brickimg = [NSObject stringWithFormat:@"brick%d", bri];
// if (CGRectIntersectsRect(ball.frame, brickimg.frame)) {
// [UIImageView stringWithFormat:@"brick%d", bri].hidden = YES;
// }
}
and also
UIImageView *brickimg = [UIImageView stringWithFormat:@"brick%d", bri];
but no chance.
How is the correct Syntax ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在正确的类(即
NSString
)上调用stringWithFormat:
怎么样?How about calling
stringWithFormat:
on the correct class, which isNSString
?