电子邮件表格查看文本

发布于 2024-11-24 08:22:20 字数 456 浏览 2 评论 0原文

我知道如何添加应用程序电子邮件,但我不知道如何通过电子邮件发送表格视图的文本。我这样做,但我的问题是,当用户将单元格添加到表格中时,我如何才能将其打印出来? 为了正常打印出我会使用的文本

string = [[NSString alloc]initWithFormat:@"%@ \n %@ \n %@",[array objectAtIndex:0], 
                                                           [array objectAtIndex:1], 
                                                           [array objectAtIndex:2]];

,并将电子邮件正文设置为字符串。有谁知道如何将其添加到添加新单元格的位置,我也可以将其添加到电子邮件正文中?

谢谢

i know how to add in app email, but i dont know how to email the text of my table view. I do, but my problem is that when the user adds a cell to the table, how do i get that to print out too?
to print out the text normally i would use

string = [[NSString alloc]initWithFormat:@"%@ \n %@ \n %@",[array objectAtIndex:0], 
                                                           [array objectAtIndex:1], 
                                                           [array objectAtIndex:2]];

and i set the email Body to string. Does anyone know how to make it to where if a new cell is added, i can get it to be added to the email body as well??

Thanks

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

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

发布评论

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

评论(3

只等公子 2024-12-01 08:22:20

我不是 100% 确定我理解你的问题,但这里是。 。 。

您可以使代码处理超过固定数量的项目,如下所示:

string = [array componentsJoinedByString:@" \n "];

如果 array 也是表视图的数据源,则 string 应包含所有表细胞之间有间隙。


您只能在向用户显示电子邮件视图之前更新 MFMailComposeViewController 中的电子邮件正文 - 一旦显示,它就是只读的:(

I'm not 100% sure I understand your problem but here goes . . .

You can make your code deal with more than a fixed number of items like this :

string = [array componentsJoinedByString:@" \n "];

If array is also the data source for your table view then string should then contain all the table cells with a break between them.


You can only update the body of your email in an MFMailComposeViewController before you have shown the email view to the user - once it's been displayed then it's read only :(

奢华的一滴泪 2024-12-01 08:22:20

我在这里假设您的数组填充有字符串对象。

编写字符串:

NSString *theMessage = [NSString stringWithFormat:@"%@ \n %@ \n %@,", [array objectAtIndex:0], [array objectAtIndex:1], [array objectAtIndex:2]];

现在,假设您还有一个 MailViewController 实例,实例化为 mailViewController,请在正文中写入以下代码:

[mailViewController setMessageBody:theMessage isHTML:NO];

I assume here that your array is populated with string objects.

Compose the string:

NSString *theMessage = [NSString stringWithFormat:@"%@ \n %@ \n %@,", [array objectAtIndex:0], [array objectAtIndex:1], [array objectAtIndex:2]];

Now, assuming you also have an instance of MailViewController, instantiated as mailViewController, write this code in for the body:

[mailViewController setMessageBody:theMessage isHTML:NO];
揽清风入怀 2024-12-01 08:22:20

首先使用上面所示的方法填充 UItableView 格式化字符串,然后在您的:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 中:

UITableViewCell *cellView = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:indexPath.row inSection:0]];//Section 0  
NSString *string=cellView.textLabel.text;
//compose email body with string

希望这有帮助。

First populate the UItableView formatting the strings with the methods indicated over, then in your:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath:

UITableViewCell *cellView = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:indexPath.row inSection:0]];//Section 0  
NSString *string=cellView.textLabel.text;
//compose email body with string

Hope this helps.

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