gpt4 book ai didi

iphone - MailComposeViewController - 当我按下按钮 "Cancel"时,我看不到带有 "Draft","Save Draft"和 "Cancel"按钮的面板

转载 作者:行者123 更新时间:2023-12-03 21:21:54 27 4
gpt4 key购买 nike

我正在使用 MFMailComposeViewController Controller ,如下所示:

MFMailComposeViewController *picker1 = [[MFMailComposeViewController alloc] init];
picker1.mailComposeDelegate = self;
[picker1 setSubject:@"I have a pencil for you"];
UIImage *roboPic = [UIImage imageNamed:@"RobotWithPencil.jpg"];
NSData *imageData = UIImageJPEGRepresentation(roboPic, 1);
[picker addAttachmentData:imageData mimeType:@"image/jpg" fileName:@"RobotWithPencil.jpg"];
NSString *emailBody = @"This is a cool image of a robot I found. Check it out!";
[picker1 setMessageBody:emailBody isHTML:YES];
picker1.navigationBar.barStyle = UIBarStyleBlack;
[self presentModalViewController:picker1 animated:YES];
[picker1 release];

当我按下“取消”按钮时,我没有看到带有“草稿”、“保存草稿”和“取消”按钮的面板,屏幕被锁定/卡住,但带有上述按钮的面板没有出现.

我很高兴获得任何帮助。

提前致谢摩西

最佳答案

you have to use this for mail composing. and in interface file write this  delegte MFMailComposeViewControllerDelegate . also import messageUi framework. its working.


#pragma mark Compose Mail
// Displays an email composition interface inside the application. Populates all the Mail fields.
-(void)displayComposer
{
if(![MFMailComposeViewController canSendMail])
{
[self setUpMailAccount];
return;
}

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"Strpy's Revange"];
[[picker navigationBar] setTintColor:[UIColor blackColor]];


// Set up recipients
NSArray *toRecipients = [NSArray arrayWithObject:@""];
NSArray *ccRecipients = [NSArray arrayWithObjects:@"", @"", nil];
NSArray *bccRecipients = [NSArray arrayWithObject:@""];

[picker setToRecipients:toRecipients];
[picker setCcRecipients:ccRecipients];
[picker setBccRecipients:bccRecipients];

// Fill out the email body text

if([UIAppDelegate gameCodeFlag]==0)
{
NSString *emailBody = [NSString stringWithFormat:@"Game Score! %d",[UIAppDelegate scorePost]];
[picker setMessageBody:emailBody isHTML:NO];
}
else {
[UIAppDelegate readFriendPlist];
NSString *emailBody = [NSString stringWithFormat:@"Game Code! %@",[UIAppDelegate gameCode]];
[picker setMessageBody:emailBody isHTML:NO];
}

[self presentModalViewController:picker animated:YES];
[picker release];
}



// Dismisses the email composition interface when users tap Cancel or Send. Proceeds to update the message field with the result of the operation.
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
// Notifies users about errors associated with the interface
switch (result)
{
case MFMailComposeResultCancelled:
break;
case MFMailComposeResultSaved:
break;
case MFMailComposeResultSent:
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"Sending..."
delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
[alert release];
break;
}
case MFMailComposeResultFailed:
break;
default:
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Email" message:@"Sending Failed - Unknown Error :-("
delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
[alert release];
}
break;
}
[self dismissModalViewControllerAnimated:YES];
if([UIAppDelegate gameCodeFlag]==1)
{
[[CCDirector sharedDirector] pushScene:[StorePage scene]];

}


}

关于iphone - MailComposeViewController - 当我按下按钮 "Cancel"时,我看不到带有 "Draft","Save Draft"和 "Cancel"按钮的面板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3872411/

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