Showing posts from May, 2012

Sending Email Landscape style in Cocos2D

[Concrete/Interesting] You know when sometimes a piece of code seems really simple, but it just won’t go right? The code just won’t behave properly. Fix one problem and another one pops up...Well, all I wanted was to use MFMailComposeViewController in my Cocos2d application. I’ve done it before so thought it would be a quick job. After many, many hours, I got it working, so to save you all the effort, here is what I did.Landscape and MFMailComposeViewControllerThe problem was the game is in Landscape mode and it seems the mail view controller doesn’t like landscape. Works beautifully on the iPad, but the iPhone sees the world in Portrait. The standard method to launch email is to call presentModelViewController. Here’s the sort of thing that works well in Portrait://Create the mail view controller
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"The Title"];

// Email Body
NSMutableString *ema…