如何在一个邮件编辑器中共享两个不同的内容?

发布于 2024-12-26 02:20:38 字数 1183 浏览 0 评论 0原文

我有两个 UIbuttons ,当单击这两个按钮时,它会显示 mailcomposer ,但是我需要在这个邮件编辑器中共享两个不同的内容,让我们考虑有两个按钮 A和B,当点击AI时需要共享文本,当我们点击B时需要共享图像。但是如何在同一个viewController中共享两个不同的内容。 我的按钮 A 的代码是

(void)displayComposerSheet {
    MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
    picker.mailComposeDelegate = self;

    [picker setSubject:@""];


    NSMutableString *emailBody =[[NSMutableString alloc]init];
    [emailBody appendString:[NSString stringWithFormat:@"%@ %@:%@",delegate.selectedBook,delegate.selectedChapter,delegate.selectedIndex]];
    [emailBody appendString:@"\n Notes: "];
    [emailBody appendString:textVieww.text];
    [emailBody appendString:@"\nShared using [MyBible app]"];

    [picker setMessageBody:emailBody isHTML:NO];

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

上面的代码用于“A”按钮,这工作正常,但接下来我想分享

[emailBody appendString:[NSString stringWithFormat:@"%@ %@:%@",delegate.image,delegate.image,delegate.image]];
[emailBody appendString:@"\n image: "];
        [emailBody appendString:@"image"];

我的“B”按钮代码。 提前致谢。

I have two UIbuttons ,when clicking these two buttons it shows the mailcomposer,but I need to share two diffrent contents in this mail composer,let us consider there are two buttons A and B ,when clicking A I need to share a text and when we click B need to share a image.But how is it possible to share two different content in a a same viewController.
My code for button A is

(void)displayComposerSheet {
    MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
    picker.mailComposeDelegate = self;

    [picker setSubject:@""];


    NSMutableString *emailBody =[[NSMutableString alloc]init];
    [emailBody appendString:[NSString stringWithFormat:@"%@ %@:%@",delegate.selectedBook,delegate.selectedChapter,delegate.selectedIndex]];
    [emailBody appendString:@"\n Notes: "];
    [emailBody appendString:textVieww.text];
    [emailBody appendString:@"\nShared using [MyBible app]"];

    [picker setMessageBody:emailBody isHTML:NO];

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

above code is used for "A" button,this works fine,but next i want to share

[emailBody appendString:[NSString stringWithFormat:@"%@ %@:%@",delegate.image,delegate.image,delegate.image]];
[emailBody appendString:@"\n image: "];
        [emailBody appendString:@"image"];

in my "B" button code.
Thanks in advance.

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

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

发布评论

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

评论(1

記憶穿過時間隧道 2025-01-02 02:20:38

我假设您想在邮件消息中切换 A 消息和 B 消息。
当邮件编辑器显示时,它是模态的,您无法更改 UI。

我认为最简单的方法是使用 3 个按钮,A 代表 A 内容,B 代表 B 内容,“C”代表同一消息中的 A 和 B 内容。

另一个解决方案是创建您自己的 mailcomposer 覆盖层,它模仿 mfmailcomposer ui ,在其中添加 2 个按钮(我认为是切换按钮),然后传递结果。

I assume you want to toggle A and B messages in the mail message.
When the mailcomposer is shown, its modal, and you can not change the UI.

I think the easiest would be to use 3 buttons, A for A-content, B for B-Content, "C" for A and B content in the same message.

Another solution is to create you own mailcomposer overlay, that mimics the mfmailcomposer ui , where you add the 2 buttons, as toggles i presume, and then pass the result.

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