<tfoot id='dtBZd'></tfoot>
    1. <small id='dtBZd'></small><noframes id='dtBZd'>

    2. <i id='dtBZd'><tr id='dtBZd'><dt id='dtBZd'><q id='dtBZd'><span id='dtBZd'><b id='dtBZd'><form id='dtBZd'><ins id='dtBZd'></ins><ul id='dtBZd'></ul><sub id='dtBZd'></sub></form><legend id='dtBZd'></legend><bdo id='dtBZd'><pre id='dtBZd'><center id='dtBZd'></center></pre></bdo></b><th id='dtBZd'></th></span></q></dt></tr></i><div id='dtBZd'><tfoot id='dtBZd'></tfoot><dl id='dtBZd'><fieldset id='dtBZd'></fieldset></dl></div>
      • <bdo id='dtBZd'></bdo><ul id='dtBZd'></ul>
      <legend id='dtBZd'><style id='dtBZd'><dir id='dtBZd'><q id='dtBZd'></q></dir></style></legend>

    3. iphone:如何在 iPhone 电子书应用程序中添加电子邮件功能

      时间:2023-10-21
        <i id='RTZxS'><tr id='RTZxS'><dt id='RTZxS'><q id='RTZxS'><span id='RTZxS'><b id='RTZxS'><form id='RTZxS'><ins id='RTZxS'></ins><ul id='RTZxS'></ul><sub id='RTZxS'></sub></form><legend id='RTZxS'></legend><bdo id='RTZxS'><pre id='RTZxS'><center id='RTZxS'></center></pre></bdo></b><th id='RTZxS'></th></span></q></dt></tr></i><div id='RTZxS'><tfoot id='RTZxS'></tfoot><dl id='RTZxS'><fieldset id='RTZxS'></fieldset></dl></div>
      1. <legend id='RTZxS'><style id='RTZxS'><dir id='RTZxS'><q id='RTZxS'></q></dir></style></legend>
      2. <tfoot id='RTZxS'></tfoot>

        <small id='RTZxS'></small><noframes id='RTZxS'>

          <tbody id='RTZxS'></tbody>

            • <bdo id='RTZxS'></bdo><ul id='RTZxS'></ul>

              • 本文介绍了iphone:如何在 iPhone 电子书应用程序中添加电子邮件功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在开发 iPhone 电子书应用程序.

                I m working on iPhone eBook app.

                在我的应用程序中,书籍是使用 HTML 创建的.在 Index.html 页面中,我必须放置通过电子邮件发送(发送)特定章节内容的电子邮件功能.

                In my app books are created using HTML. In Index.html page i have to put the email functionality which email(send) the contents of particular chapter.

                现在通过使用 webview 我显示 index.html 并且我创建了 UIActionSheet 它将显示电子邮件按钮.

                Now by using webview i show the index.html and in that i have created UIActionSheet which will show the Email button.

                请建议我如何识别要发送的不同链接的索引特定章节的电子邮件.

                Please suggest me that how can i identify the index of different links to send email of particular chapter.

                推荐答案

                即使您没有在设备中配置电子邮件,以下代码也可以使用.

                Below code will work even if you have not configured email in your device.

                代码如下:

                - (IBAction) sendEmail:(id)sender
                {
                    Class mailClass = (NSClassFromString(@"MFMailComposeViewController"));
                if (mailClass != nil)
                {
                    // We must always check whether the current device is configured for sending emails
                    if ([mailClass canSendMail])
                    {
                        [self displayComposerSheet];
                    }
                    else
                    {
                        [self launchMailAppOnDevice];
                    }
                }
                else
                {
                    [self launchMailAppOnDevice];
                }
                }
                
                -(void)displayComposerSheet 
                {
                    MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
                    picker.mailComposeDelegate = self;
                
                    [picker setSubject:@"Hello from DShah!"];
                
                    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];
                
                    NSString *path = [[NSBundle mainBundle] pathForResource:@"userdata" ofType:@"abc"];
                    NSFileManager *fileManager = [NSFileManager defaultManager];
                    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
                    NSString *documentsDirectory = [paths objectAtIndex:0];
                    NSString *fullPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.abc", @"userdata"]]; 
                    NSData *myData = [NSData dataWithContentsOfFile:fullPath];
                    [picker addAttachmentData:myData mimeType:@"csv" fileName:@"userdata.abc"];
                
                    NSString *emailBody = @"It is raining in sunny California!";
                    [picker setMessageBody:emailBody isHTML:NO];
                
                    [self presentModalViewController:picker animated:YES];
                    [picker release];
                }
                
                -(void)launchMailAppOnDevice
                {
                    NSString *recipients = @"mailto:first@example.com&subject=Hello from DShah!";
                    NSString *body = @"&body=It is cold in Winter!";
                
                    NSString *email = [NSString stringWithFormat:@"%@%@", recipients, body];
                    email = [email stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
                
                    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:email]];
                }
                

                然后如下实现Delegate方法....

                Then implement the Delegate method as below....

                - (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error 
                {
                    switch (result)
                    {
                        case MFMailComposeResultCancelled:
                            message = @"Result: canceled";
                            break;
                        case MFMailComposeResultSaved:
                            message = @"Result: saved";
                            break;
                        case MFMailComposeResultSent:
                            message = @"Result: sent";
                            break;
                        case MFMailComposeResultFailed:
                            message = @"Result: failed";
                            break;
                        default:
                            message = @"Result: not sent";
                            break;
                    }
                
                    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Email Demo" message:message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
                    [alert show];
                    [alert release];
                
                    [self dismissModalViewControllerAnimated:YES];
                }
                

                这篇关于iphone:如何在 iPhone 电子书应用程序中添加电子邮件功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:如何加载 Web 视图中的 url 链接并将其保留在 SWIFT 中的该 Web 视图中 下一篇:UIWebView 加载进度并调整网页以适应视图页面?

                相关文章

                <i id='TYKXY'><tr id='TYKXY'><dt id='TYKXY'><q id='TYKXY'><span id='TYKXY'><b id='TYKXY'><form id='TYKXY'><ins id='TYKXY'></ins><ul id='TYKXY'></ul><sub id='TYKXY'></sub></form><legend id='TYKXY'></legend><bdo id='TYKXY'><pre id='TYKXY'><center id='TYKXY'></center></pre></bdo></b><th id='TYKXY'></th></span></q></dt></tr></i><div id='TYKXY'><tfoot id='TYKXY'></tfoot><dl id='TYKXY'><fieldset id='TYKXY'></fieldset></dl></div>

                  <bdo id='TYKXY'></bdo><ul id='TYKXY'></ul>
                <legend id='TYKXY'><style id='TYKXY'><dir id='TYKXY'><q id='TYKXY'></q></dir></style></legend>

                1. <small id='TYKXY'></small><noframes id='TYKXY'>

                  <tfoot id='TYKXY'></tfoot>