我试图在我的应用程序中插入邮件工具。...我的应用程序基于cocos2d引擎
工具栏(在顶部->取消,发送...)可见,但我看不到mfMailComposerViewController视图的其他部分:-(
码:
-(void)displayComposerSheet {
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"my message"];
// Set up recipients
NSArray *toRecipients = [NSArray arrayWithObject:@"[email protected]"];
NSArray *ccRecipients = [NSArray arrayWithObjects:@"[email protected]", @"[email protected]", nil];
NSArray *bccRecipients = [NSArray arrayWithObject:@"[email protected]"];
[picker setToRecipients:toRecipients];
[picker setCcRecipients:ccRecipients];
[picker setBccRecipients:bccRecipients];
// Attach an image to the email
UIImage *screenshot = [[Director sharedDirector] screenShotUIImage];
NSData *myData = UIImagePNGRepresentation(screenshot);
[picker addAttachmentData:myData mimeType:@"image/png" fileName:@"AdMotiv"];
// Fill out the email body text
NSString *emailBody = @"test";
[picker setMessageBody:emailBody isHTML:NO];
[[picker view] setFrame:CGRectMake(0.0f,0.0f,320.0f, 480.0f)];
[[picker view] setTransform:CGAffineTransformIdentity];
[[picker view] setBounds:CGRectMake(0.0f,0.0f,320.0f, 480.0f)];
//[[[VariableStore sharedInstance] parentView] setTransform: CGAffineTransformIdentity];
//[[[VariableStore sharedInstance] parentView] setBounds : CGRectMake(0.0f, 0.0f, 480.0f, 320.0f)];
UITextField *textfeld = [[UITextField alloc] initWithFrame:CGRectMake(50.0f, 50.0f, 100.0f, 100.0f)];
[[picker view] addSubview:textfeld];
[[[VariableStore sharedInstance] window]addSubview:picker.view];
[[[VariableStore sharedInstance] window] makeKeyAndVisible];
[picker release];
}
最佳答案
嘿,终于。我已经开始工作了……似乎麻烦是一些动画…………我现在已经这样了:
在初始化时:
emailController = [[UIViewController
alloc] init]; [[[CCDirector
[sharedDirector] openGLView]
addSubview:emailController.view];
在按钮上单击:
[[CCDirector sharedDirector]暂停];
[[CCDirector sharedDirector]
stopAnimation];
MFMailComposeViewController * picker =
[[MFMailComposeViewController分配]
在里面]; picker.mailComposeDelegate =
自;
[picker setSubject:@“ TEST”]; [选择器
setMessageBody:@“ JAJAJA” isHTML:YES];
[emailController
presentModalViewController:picker
动画:是]; [选择释放];
MFMailComposeViewController的委托方法
-(void)mailComposeController:(MFMailComposeViewController *)控制器
didFinishWithResult:(MFMailComposeResult)结果
错误:(NSError *)错误{[[CCDirector
[sharedDirector]简历]; [[CCDirector
[sharedDirector] startAnimation];
[控制器
dismissModalViewControllerAnimated:NO];
}