2011-12-18 87 views
1

我想編譯一箇舊的代碼工作。與ios5 Cocos2d問題

PlayView *layer = [[[PlayView alloc] initWithColor:ccc4(180, 180, 200, 255)] autorelease]; 

我得到這個錯誤:

Cannot Convert 'ccCoor4b' to 'ci' color in argument passing.

誰能幫助我?

+0

PlayView是CCLayerColor?這段代碼應該工作,我沒有得到錯誤 – Ultrakorne

+0

你可以在這裏發佈'PlayView :: initWithColor:'和'ccc4(...)'的聲明嗎? – brigadir

回答

0

這將工作!

PlayView *layer = [[[PlayView alloc] initWithColor:(ccColor4B){180, 180, 200, 255}] autorelease]; 

你可以試試這個辦法還,

ccColor4B c; 
c.r=180,c.g=180,c.b=200,c.a=255; 
//then use 'c' as ccColor4B object 
+0

試過了,完全一樣的錯誤。 – user965010

2

變化代碼:

return [[(CCLayerColor*)[self alloc] initWithColor:color] autorelease];