1
我在iPad應用程序中使用以下代碼作爲郵件編輯器工作表。我爲iPhone使用了相同的代碼。有效。
我正在使用cocos2d在iPad上編寫遊戲。遊戲處於landScape模式。 EmailScene中的控件停止在[picker presentModalViewController:picker animated:YES];它沒有給出任何錯誤。我應該更改iPad的代碼嗎?presentModalViewController:picker在iPad中不起作用MFMailComposeViewController
@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:@"[email protected]"];
[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];
}
但問題是我的遊戲處於橫向模式,郵件表以縱向模式顯示。 謝謝。
我只有一個視圖控制器和我的接口類我的問題添加。遊戲在cocos2d中。什麼是我的程序中最頂級的ViewController? 謝謝。 – 2010-07-06 04:26:31
@srikanth:「topmostViewController」是可見的視圖控制器。在你的情況下,這是「只有一個視圖控制器」。 – kennytm 2010-07-06 06:06:39
在我的遊戲中,只有一個視圖控制器在那裏。當我們在場景中觸摸CCLabel時,應顯示郵件表單。所以,我將EmailScene作爲視圖控制器。 謝謝。 – 2010-07-06 06:13:59