iPadアプリケーションのメールコンポーザシートに次のコードを使用しています。iPhoneでも同じコードを使用しました。出来た。
cocos2dを使ってiPadでゲームを書いています。ゲームはlandscapeモードです。EmailScene のコントロールが [picker presentModalViewController:picker animation:YES] で停止しています。エラーは発生していません。iPad 用にコードを変更する必要がありますか?
@interface EmailScene : CCScene <MFMailComposeViewControllerDelegate>
{
MFMailComposeViewController *picker;
}
-(void)displayComposerSheet;
@end
@implementation EmailScene
- (id) init {
self = [super init];
if (self != nil) {
[self displayComposerSheet];
}
return self;
}
// Displays an email composition interface inside the application. Populates all the Mail fields.
-(void)displayComposerSheet
{
[[CCDirector sharedDirector] pause];
picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
//Fill in the email as you see fit
NSArray *toRecipients = [NSArray arrayWithObject:@"srikanth.rongali786@gmail.com"];
[picker setToRecipients:toRecipients];
//display the view
[[[CCDirector sharedDirector] openGLView] addSubview:picker.view];
[[CCDirector sharedDirector] stopAnimation];
//When I commented the following two lines the mail page is opening.
//[picker presentModalViewController:picker animated:YES];
//[picker release];
}
しかし、問題は私のゲームが横向きモードで、メールシートが縦向きモードで表示されていることです。ありがとうございました。