gpt4 book ai didi

iphone - cocos2d MFMailComposeViewController

转载 作者:行者123 更新时间:2023-12-03 19:43:07 26 4
gpt4 key购买 nike

我尝试在我的应用程序中插入邮件工具......我的应用程序基于cocos2d引擎

工具栏(顶部 ->取消、发送...)可见,但我看不到 mfMailComposerViewController View 的其他部分:-(

代码:

-(void)displayComposerSheet {   
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"my message"];

// Set up recipients
NSArray *toRecipients = [NSArray arrayWithObject:@"first@example.com"];
NSArray *ccRecipients = [NSArray arrayWithObjects:@"second@example.com", @"third@example.com", nil];
NSArray *bccRecipients = [NSArray arrayWithObject:@"fourth@example.com"];

[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] pause]; [[CCDirector sharedDirector] stopAnimation];

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; picker.mailComposeDelegate = self;

[picker setSubject:@"TEST"]; [picker setMessageBody:@"JAJAJA" isHTML:YES];

[emailController presentModalViewController:picker animated:YES]; [picker release];

MFMailComposeViewController 的委托(delegate)方法

-(void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error { [[CCDirector sharedDirector] resume]; [[CCDirector sharedDirector] startAnimation];
[controller dismissModalViewControllerAnimated:NO]; }

关于iphone - cocos2d MFMailComposeViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1427557/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com