my app is in landscape mode, when i open the email sheet, that is in portrait-and its ok, the keyboard is opened in landscape,so i have portrait email sheet,and landscape keyboard.
How do i fix it , that the keyboard will be in in portrait also ?
WHY when pressing “cancel” , its not going back to the app and nothing happens ?
//send email log-------------------------
NSLog(@"mail");
[[CCDirector sharedDirector] pause];
picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
//Fill in the email as you see fit
NSArray *toRecipients = [NSArray arrayWithObject:@"r@gmail.com"];
[picker setToRecipients:toRecipients];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *dataPath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"BetaTest.txt"];
NSData *data = [NSData dataWithContentsOfFile:dataPath];
[picker addAttachmentData:data mimeType:@"text/txt" fileName:@"BetaTest.txt"];
NSString *emailBody = @"test :) ";
[picker setMessageBody:emailBody isHTML:NO];
[picker setSubject:@"hardware test##"];
//display the view
[[[CCDirector sharedDirector] openGLView] addSubview:picker.view];
[[CCDirector sharedDirector] stopAnimation];
Instead of adding the view of the
MFMailComposeViewControllerinstance to your currently active view, you’ll need to display it as a modal view controller. Unfortunately, cocos2d (which I assume you are using from theCCDirectorclass you have in your code) isn’t built on top of the default UIKit displays.This means you’ll have to find your application’s root view controller and call its
presentModalViewController:method. There are several ways to do this, for example the method detailed in this blog post (written by someone else, but a decent approach): http://indiedevstories.com/2011/06/25/modal-view-controllers-in-cocos2d/