2012-04-03 35 views
1

我有一個CCLayerColor:CCLayerColor問題

"NameLayer" = [CCLayerColor layerWithColor: (ccc4 (125.125, 
225.225))width: height 118.0f, 118.0f]; 

其中初始化另一個類:

"nameColor" = [[NameLayer alloc] init]; 

現在我想做一個方法來改變我的CCLayerColor的大小,但我不明白它。

我使用:

[nameColor setContentSize: size], 

,但在我看來,我改變了層的「內部」,而不是長度的大小。我希望我已經向我解釋了這個問題。

問候

回答

0

您需要使用變化- (void) changeWidth:(GLfloat)w height:(GLfloat)h不setContentSize。但爲什麼 ?

  • 方法setContentSize將設置層不是層的尺寸,等你告訴的內容的大小:it seems to me that I change the size of "inside" of the layer and not the length.

  • 方法changeWidth:高度:將設置的寬度和高度的圖層,而不是圖層的內容!

希望它能幫助你!

+0

這或多或少是我想要做的。我創建了方法' - (void)changeWidth:(GLfloat)w height:(GLfloat)h'我試着改變方法,但是我沒有明白,不應該做好代碼。他需要更多的提示,我想我缺乏一些東西。 問候 – user1155232 2012-04-03 11:30:36

+0

你需要做一些事情:[nameColor changeWidth:50 height:50]; – ggrana 2012-04-03 11:32:32

+0

只要讓我這樣做:[self changeWidth:50 height:50]; ,不能這樣做:[nameColor changeWidth:50 height:50] ;.我不懂爲什麼。 – user1155232 2012-04-03 11:57:19