OGeek|极客世界-中国程序员成长平台

标题: iphone - 如何在 MFMailViewController setToRecipients 中的数组中选择索引? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 10:45
标题: iphone - 如何在 MFMailViewController setToRecipients 中的数组中选择索引?

我在 Xcode 中使用 MFMailViewController,并且我有这一行设置收件人。

[mailComposer setToRecipients:emailAddresses];

我需要将收件人设置为 NSArray 中的某个索引,但我不知道如何执行此操作。

如果您仍然不明白我的意思,我需要电子邮件地址是一个人或另一个人,具体取决于用户输入的内容。



Best Answer-推荐答案


你需要这样做:

if (useBobsEmail)
{
    [mailComposer setToRecipients[@"[email protected]"]];
}
else
{
    [mailComposer setToRecipients[@"[email protected]]];
}

@[] 表示法,如果你不知道的话,可以用来代替 [NSArray arrayWithObjects:]

关于iphone - 如何在 MFMailViewController setToRecipients 中的数组中选择索引?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16258340/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4