i have project code in cocos and cocos2d and have problem in orientation
- by Sukhi
i have project code in cocos and cocos2d and have problem in orientation .
my game is in landscape mode part of its code in cocos2d and another one is in cocos .
cocos2d views orientations is working fine .
i put this code in appdelegate.m file
-(void)orientationChanged:(NSNotification *)notification
{
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
if( orientation == UIInterfaceOrientationLandscapeLeft)
{
[[CCDirector sharedDirector] setDeviceOrientation: kCCDeviceOrientationLandscapeRight];
}
else if( orientation == UIInterfaceOrientationLandscapeRight)
{
[[CCDirector sharedDirector] setDeviceOrientation: kCCDeviceOrientationLandscapeLeft];
}
}
but when i go to cocos code its view look good but as soon as i change the rotation LandscapeRight to LandscapeLeft my views goes in potrate mode
i wrote following code in UIViewController
(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Overriden to allow any orientation.
BOOL orienationStatus=FALSE;
if (interfaceOrientation ==UIInterfaceOrientationLandscapeLeft || interfaceOrientation==UIInterfaceOrientationLandscapeRight)
{
orienationStatus=TRUE;
}
return orienationStatus;
}
whats wrong in that i don't know ....
help will be appreciated .....