【问题标题】:Add linebreak or newline in Instagram text from objective-c text从objective-c文本在Instagram文本中添加换行符或换行符
【发布时间】:2015-04-24 10:58:58
【问题描述】:

我正在使用来自 Xcode 的 Instagram API,但我无法使用 \n 在文本中插入换行符。谁能帮我在 XCode 的 instagram 文本的标题/评论中添加新行?

    NSString *repostText = [NSString stringWithFormat:@"#Repost %@ com #AppRepost.\r\n                      ・・・                            \r\n", userNameStr];

【问题讨论】:

  • 为什么是\r? \n 本身就足够了。
  • 澄清您的问题。问题是什么?您期待什么结果?
  • 我需要在 cmets Instagram 中添加断线。我把 \n 放到新行但不起作用。和 \r 如果等于 cr 但不再工作。

标签: ios objective-c string instagram-api format-string


【解决方案1】:
1.[NSString StringWithFormat:@"%@\r%@",string1,string2];



2.[NSString StringWithFormat:@"string1\rstring2];

试试这个

【讨论】:

    【解决方案2】:

    我解决了这个问题。

    经过多次尝试,我设法在 Instagram cmets 中使用 Python source code encoding 换行!

    NSString *breakLine = @"\u2029";
    

    这段代码

    \u2029" - '段落分隔符'

    【讨论】:

      猜你喜欢
      • 2012-03-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-22
      • 2010-09-09
      • 2011-02-23
      • 2011-03-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多