0
我有一个问题搞清楚究竟什么是错在这里:代码中的Xcode奇怪的错误?
-(void) fireShots {
[laserBeam stop];
[laserBeam setCurrentTime:0];
[laserBeam play];
UIImageView *aShot = [[UIImageView alloc] initWithFrame:CGRectMake(actorImage.center.x, actorImage.center.y, 26, 36)];
[aShot setImage:[UIImage imageNamed:@"Laser- rød.png"]];
[allShots addObject:aShot];
if (moveAllShots == nil)
moveAllShots = [NSTimer scheduledTimerWithTimeInterval:1.0/50
target:self
selector:@selector(moveAllShots)
userInfo:nil
repeats:YES];
[actorImage.superview addSubview:aShot];
}
的方法有3个错误:预期;表达式之后(试图通过在moveallShots == nil处插入它来修复它,这显然是不正确的。) 预期表达式(同一行,它是用[allShots addObject:aShot]表示的行; 使用未声明的标识符aShot,不可能是真的要么因为它是在该方法制造。
真想不通这一个。谢谢你对提前,
/JBJ
注 - 我只是解决了NSTimer moveAllShots的问题,但与[allShots addObject:aShot]一致的问题;仍然存在 - 我相信NSMutableArray是分配的,所以我不知道这里有什么错。 – Seerex 2012-01-28 17:19:49
allShots定义在哪里? – Nick 2012-01-28 17:19:56
NSMutableArray * allShots;在该类 – Seerex 2012-01-28 17:24:23