预期的标识符错误? XCODE

时间:2013-03-29 03:38:39

标签: xcode cocos2d-iphone kobold2d

- (void)tapped:(id)sender
{
    if (counter ==1) {

        bluetest.position = ccp(400, 400);
    }
}

blue = [[CCMenuItemImage
            itemFromNormalImage:@"blue.png" selectedImage:@"blueclick.png"
             target:self selector:@selector(tapped:)];  //error occurs here

    bluetest.position = ccp(175, 350);
    bluetest = [CCMenu menuWithItems:blue, nil];
    bluetest.position = CGPointZero;
    bluetest.scale = .75;
    [self addChild:bluetest z:3];

错误显示“预期标识符”。我该怎么做才能解决错误?

1 个答案:

答案 0 :(得分:0)

@ user2083920,

首先删除'['。你在开始时使用了双'[',只有一个结束']'。然后编译器将搜索另一个结束']'并给出上面的错误或者如果你忘了粘贴所有这里。请粘贴原始代码。

 [[CCMenuItemImage
            itemFromNormalImage:@"blue.png" selectedImage:@"blueclick.png"
             target:self selector:@selector(tapped:)];