在ios中使用tableview和饼图发送电子邮件

发布于 2024-12-27 23:11:28 字数 143 浏览 5 评论 0原文

我是ios应用程序开发的新手。所以如果有任何错误,请容忍我。我想从我的应用程序发送一封带有附件的电子邮件。附件包含表格视图和饼图。我在谷歌中搜索并找到截图和发送邮件。 。但是我的表视图中有很多行。那么还有其他更好的替代方法来将数据表作为邮件附件发送吗?任何帮助将不胜感激。

I am new to ios application Development.So pls bear me if anywhere i m wrong.I want to send an email from my app with the attachment.Attachment contains tableview and a pie chart.I searched in google and find taking screenshots and sending mail..But i have lot of rows in my tableview.So is that any other better alternative way to send a table of data as a mail attachment? any help would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

撑一把青伞 2025-01-03 23:11:28

您可以根据 tableview 数据创建一个 html 表。使用一些 NSString 魔法可以很容易地创建 HTML 表格。
一个非常基本的表如下所示:

<table border="1">
  <tr>
    <td>row 1, cell 1</td>
    <td>row 1, cell 2</td>
  </tr>
  <tr>
    <td>row 2, cell 1</td>
    <td>row 2, cell 2</td>
  </tr>
</table>

创建此类表的代码可能如下所示:

    NSString *tableStart = @"<table border=\"1\">\n";
    NSString *rowStart = @"  <tr>\n";
    NSString *cellStart = @"    <td>";
    NSString *cellEnd = @"</td>\n";
    NSString *rowEnd = @"  </tr>\n";
    NSString *tableEnd = @"</table>";

    NSMutableString *table = [NSMutableString string];
    [table appendString:tableStart];
    for (MyObject *object in self.dataSource) {
        [table appendString:rowStart];  // one row for each object

        [table appendString:cellStart]; // first cell for title
        [table appendString:object.title];
        [table appendString:cellEnd];

        [table appendString:cellStart]; // second cell for rating
        [table appendFormat:@"Rating %d", object.rating];
        [table appendString:cellEnd];

        [table appendString:rowEnd];
    }
    [table appendString:tableEnd];

这将创建一个非常基本的表。有了一些 html 知识,你就可以添加更多的创意。

当您将该表嵌入到 html 文档中并以 html 形式发送电子邮件时。

如果你想走这条路,你必须学习 html 的基础知识。网络上有很多关于这方面的信息。您可以从这两个链接开始。

http://dev.opera。 com/articles/view/1-introduction-to-the-web-standards-cur/#toc
http://dev.opera.com/articles/view/19-html-表/

you could create a html table out of your tableview data. HTML tables are quite easy to create with some NSString magic.
A very basic table looks like this:

<table border="1">
  <tr>
    <td>row 1, cell 1</td>
    <td>row 1, cell 2</td>
  </tr>
  <tr>
    <td>row 2, cell 1</td>
    <td>row 2, cell 2</td>
  </tr>
</table>

the code to create such a table could look like this:

    NSString *tableStart = @"<table border=\"1\">\n";
    NSString *rowStart = @"  <tr>\n";
    NSString *cellStart = @"    <td>";
    NSString *cellEnd = @"</td>\n";
    NSString *rowEnd = @"  </tr>\n";
    NSString *tableEnd = @"</table>";

    NSMutableString *table = [NSMutableString string];
    [table appendString:tableStart];
    for (MyObject *object in self.dataSource) {
        [table appendString:rowStart];  // one row for each object

        [table appendString:cellStart]; // first cell for title
        [table appendString:object.title];
        [table appendString:cellEnd];

        [table appendString:cellStart]; // second cell for rating
        [table appendFormat:@"Rating %d", object.rating];
        [table appendString:cellEnd];

        [table appendString:rowEnd];
    }
    [table appendString:tableEnd];

this will create a very basic table. With some html knowledge you can add more fanciness.

When you have that table embed it in a html document and send the email as html.

If you want to go this way you have to learn the basics of html. There is a lot of information about this in the web. You could start with those two links.

http://dev.opera.com/articles/view/1-introduction-to-the-web-standards-cur/#toc
http://dev.opera.com/articles/view/19-html-tables/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文