I'm working on a Landscape Mode app and it also has a "send mail" option just as in "51 Japanese Characters". However, when i run the code the In-App mail view is opened in Portrait mode. The portrait mode persists even after closing In-App mail and it also can't be reset to Landscape mode via the CCDirector setOrientation method.
My UIViewController loads the view like this:
-(void) loadView
{
self.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
self.wantsFullScreenLayout = YES;
UIView *view = [[UIView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame];
view.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
view.backgroundColor = [UIColor clearColor];
view.clearsContextBeforeDrawing = NO;
view.opaque = NO;
//view.transform = CGAffineTransformRotate(view.transform, (float)degreesToRadians(180));
self.view = view;
[view release];
}
I tried playing with view.transform as you can see but nothing changed anything.
Here's the method that shows the view:
+(void) showUIViewController:(UIViewController *)controller
{
NSAssert(viewController == nil, @"CocoaHelper - a viewController is already in use!");
if (viewController == nil)
{
viewController = [controller retain];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0f];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:[[CCDirector sharedDirector] openGLView] cache:YES];
switch ([[CCDirector sharedDirector] deviceOrientation])
{
case CCDeviceOrientationLandscapeLeft:
[viewController.view setTransform:CGAffineTransformMakeRotation((float)M_PI_4)];
controller.view.center = CGPointMake(240, 160);
break;
case CCDeviceOrientationLandscapeRight:
//[viewController.view setTransform:CGAffineTransformMakeRotation((float)M_PI_2)];
controller.view.center = CGPointMake(160, 240);
break;
case CCDeviceOrientationPortraitUpsideDown:
//[viewController.view setTransform:CGAffineTransformMakeRotation((float)M_PI_2)];
controller.view.center = CGPointMake(160, 240);
break;
case CCDeviceOrientationPortrait:
default:
controller.view.center = CGPointMake(160, 240);
break;
}
[[[CCDirector sharedDirector] openGLView] addSubview:viewController.view];
[[CCDirector sharedDirector] pause];
[UIView commitAnimations];
}
}
Again, i thought i should modify the controller.view.transform property but nothing changed either.
I would prefer the In-App mail to open in landscape mode but if that's not possible, at least i want to reset the app back to Landscape mode after removing the In-App mail view.
Any thoughts on this? What am i missing?