Cocos2D UITextView不与GLView一起旋转
问题描述:
因此,我在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。
答
打开文件GameConfig.h
,定义自动旋转类型。希望它会有所帮助。
感谢您的回复。 我检查过,我在GameConfig.h中有这个 #define GAME_AUTOROTATION kGameAutorotationUIViewController 所以我想它已经定义了?自动旋转适用于gl组件,只有textview不能正确旋转。 – Sev
试试这行[[[CCDirector sharedDirector] openGLView] addSubview:self];不使用窗口。 – PeakCoder
它的工作原理!万分感谢! – Sev