【问题标题】:why arent placeholders not working?为什么占位符不起作用?
【发布时间】:2013-08-28 07:03:21
【问题描述】:
testMsg.toEmail = @"%@@txt.att.net", phoneNumberEntry.text;

嗨,所以我想让 testMsg.toEmail 成为(phoneNumberEntry 文本)@txt.att.net。我试着用占位符来做,但没有用。我该如何解决?

【问题讨论】:

  • 你上一个问题使用[NSString stringWithFormat:...] - 这可能在这里有用:-)
  • 我试过 [NSString stringWithFormat phoneNumberEntry] 和 [NSString stringWithFormat phoneNumberEntry.text]。他们都没有工作
  • 对不起。它没有成功发送电子邮件。我知道这些框架很有价值,因为我将 testMsg.toEmail 切换为我的电子邮件字符串,并且效果很好。

标签: ios cocoa-touch placeholder


【解决方案1】:

我认为 Martin 是对的,您可以使用此代码-:

testMsg.toEmail =  [NSString stringWithFormat:@"%@@txt.att.net",phoneNumberEntry.text];

【讨论】:

  • btw phoneNumberEntry 是一个文本字段。另外,当我尝试上面的代码时,消息没有发送。
  • @DaniM.Smith 使用 NSLog(testMsg.toEmail) 在这个语句之后查看 textMsg.toEmail 的内容,看看你得到了什么。如果您也可以发布相关代码段,那很好,因为其他地方可能还有其他问题。
猜你喜欢
  • 1970-01-01
  • 2021-10-23
  • 1970-01-01
  • 2013-09-28
  • 2014-03-04
  • 2015-03-24
  • 2017-06-29
  • 1970-01-01
  • 2021-11-02
相关资源
最近更新 更多