2012-04-13 81 views
0

我试图在像这样的方法参数中传递数组cpVect;花栗鼠cpVect在方法参数中的类型不兼容

cpVect v1[] = { 
     cpv(-31.5f/2.0, 70.5f/2.0), 
     cpv(43.5f/2.0, 65.5f/2.0), 
     cpv(34.5f/2.0, -69.5f/2.0), 
     cpv(-52.5f/2.0, -69.5f/2.0) 
    }; 

Rocks *rock = [[Rocks alloc] initWithSpace:space location:ccp(200, 700) filename:@"2_piedra1.png" verts:v1]; 

和方法:

- (Rocks *)initWithSpace:(cpSpace *)theSpace location:(CGPoint)location filename:(NSString *)filename verts:(cpVect)verts; 

但没有与该类型

感谢您的帮助

回答

0

你的方法应该是这样的:

  • (岩*)initWithSpace:(cpSpace *)theSpace l (CGPoint)位置文件名:(NSString *)文件名verts:(cpVect *)verts;

请注意最后一个参数上的cpVect之后的'*'。您正在传递一个cpVect值的数组(指针),而不仅仅是一个。

+0

那就是!谢谢。如此盲:( – returnvoid 2012-05-15 22:07:01