0

i had a cocos2d game having some UIViewController's view.

1) when only cocos2d view is present orientation changes works fine 2) when only UIViewController's view is present orientation changes works fine

But when i have a UIViewController on top of cocos2d view, the orientation change effect does't propagates to cocos2d view i.e UIViewController is rotated and cocos2d remains the same.

I have tried bunch of solutions, please see im using cocos2d 2.x version.

Please help.

tashfeen
  • 187
  • 1
  • 9

1 Answers1

0

Use custom class (UIViewController or UIView - according to your need) then override the orientation methods...then use NSNotification & NSNotification​Center to observe the change from Cocos2D class and change the orientation of custom class accordingly.

Given below links might help you along the way:

Community
  • 1
  • 1
Aritra Das
  • 416
  • 3
  • 4
  • Let say i get the notification of orientation change, how do i change the cocos2d orientation manually ? – tashfeen Oct 23 '14 at 12:57
  • First You need to set:[[CCDirector sharedDirector] setDelegate: self]; then In that same file add this:- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{ return (interfaceOrientation == YourInterfaceOrientation); } – Aritra Das Oct 23 '14 at 13:25
  • thanks but shouldAutorotateToInterfaceOrientation is not being called – tashfeen Nov 07 '14 at 08:21