Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 对象需要对象c类中的说明符或限定符_Iphone_Objective C_Xcode_Cocos2d Iphone - Fatal编程技术网

Iphone 对象需要对象c类中的说明符或限定符

Iphone 对象需要对象c类中的说明符或限定符,iphone,objective-c,xcode,cocos2d-iphone,Iphone,Objective C,Xcode,Cocos2d Iphone,我正在构建的类是CCSprite的一个子类: 问题是我一直得到“类型名需要一个说明符或限定符” 我在错误出现的地方对代码进行了注释。我不确定我做错了什么 int tileSize = 80; Boolean moveable = true; id moveUp,moveRight,moveDown,moveLeft; @interface Player : CCSprite { //On these lines. moveUp = [CCMoveTo actionWithDuration:

我正在构建的类是CCSprite的一个子类:

问题是我一直得到“类型名需要一个说明符或限定符”

我在错误出现的地方对代码进行了注释。我不确定我做错了什么

int tileSize = 80;
Boolean moveable = true;
id moveUp,moveRight,moveDown,moveLeft;

@interface Player : CCSprite {

//On these lines. 
moveUp = [CCMoveTo actionWithDuration:2 position:ccp(0, 0 - tileSize)];
moveDown = [CCMoveTo actionWithDuration:2 position:ccp(0,0+tileSize)];
moveRight = [CCMoveTo actionWithDuration:2 position:ccp(0+tileSize,0)];
moveLeft = [CCMoveTo actionWithDuration:2 position:ccp(0-tileSize,0)];


}


-(void)move;



@end


@implementation Player{





@end

你不能像那样把代码放在你的接口中——它需要放在一个方法或函数中。这里应该包含的唯一内容是属性列表。

我强烈建议您在熟悉基础知识之前不要再编写另一行Objective-C代码。