我已經添加了幾個UIKit項目到我的圖層,一個UITableView和一個UITextField。動畫UIKit項目與場景轉換
如何在轉換過程中讓這些項目與場景的其餘部分一起動畫?
我曾經嘗試都通過CCDirector添加項目,
[[[CCDirector sharedDirector] openGLView] addSubview:tableView];
除了使用CCUIViewWrapper類。
無論哪種方式,cocos2d項目都會轉換,但UIKit項目仍保留在屏幕上,並且不會與屏幕的其餘部分進行動畫製作。
HelloWorldLayer *scene = (HelloWorldLayer *)[HelloWorldLayer scene];
[[CCDirector sharedDirector] replaceScene:[CCTransitionZoomFlipX transitionWithDuration:0.5 scene:(CCScene *)scene]];
只是用於測試中,我使用這裏示出的旋轉按鈕例如: http://www.cocos2d-iphone.org/forum/topic/6889 並加入到以上按鈕動作的replaceScene代碼。
如果你還添加了一個CCLabelTTF到屏幕上,你會注意到標籤帶有過渡動畫,但按鈕沒有。