2012-11-13 20 views
0

因此,我在Cocos2D的OpenGL視圖中添加了UITextView。 做了一些旋轉,以適應我的風景和所有。但不知何故,當整個場景旋轉時,textview不會。我試過Cocos2D UITextView不與GLView一起旋轉

[[[CCDirector sharedDirector] openGLView] window].autoresizesSubviews = YES; 

,幷包括了這些功能,但它仍然原地踏步..

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
- (void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration 

什麼想法?

我一直在使用它添加到我的openGLView:

[[[[CCDirector sharedDirector] openGLView] window] addSubview:self]; 

我從類繼承的UITextView。

回答

0

打開文件GameConfig.h,定義自動旋轉類型。希望它會有所幫助。

+0

感謝您的回覆。 我檢查過,我在GameConfig.h中有這個 #define GAME_AUTOROTATION kGameAutorotationUIViewController 所以我想它已經定義了?自動旋轉適用於gl組件,只有textview不能正確旋轉。 – Sev

+0

試試這行[[[CCDirector sharedDirector] openGLView] addSubview:self];不使用窗口。 – PeakCoder

+0

它的工作原理!萬分感謝! – Sev