【问题标题】:Unicode symbol for BOLD arrow shows incorrect UI in UILabel iOS 7粗体箭头的 Unicode 符号在 UILabel iOS 7 中显示不正确的 UI
【发布时间】:2014-06-12 11:09:30
【问题描述】:

我正在使用来自此链接http://en.wikipedia.org/wiki/Miscellaneous_Symbols_and_Arrows 的粗体向上和向下箭头的 unicode 符号

但它在箭头周围显示蓝色框,如下图所示

我的代码如下

NSString *strMore = @"\u2B06" ;
NSString *strLess = @"\u2B07" ;

self.lblMore.text = strMore;
self.lblLess.text = strLess;

谁能告诉我怎么回事?

【问题讨论】:

  • 仅由该文本处理还是您也使用情节提要?
  • 它只是 xib 文件中的一个 UILabel。我没有使用故事板

标签: ios objective-c unicode


【解决方案1】:

带有蓝色框的箭头是Emoji 箭头,具有相同的Unicode。在 OS X 上打开 Character Viewer(Control + Option + Space)以查找代码并检查左侧窗格中 Arrows 部分的 Unicode。使用该 unicode 应该可以解决问题,因为它不会与 Emoji 箭头代码混淆!

更新抱歉,我目前无法访问 Mac,因此我无法自己查找代码。显然,如果您将 \U0000FE0E 添加到您的 unicode 中,那将避免使用表情符号。所以在你的情况下:

代替:

NSString *strMore = @"\u2B06" ; //This will map the character to the Emoji icon; the blue up arrow.
NSString *strLess = @"\u2B07" ; //This will map the character to the Emoji icon; the blue down arrow.

写:

NSString *strMore = @"\u2B06\U0000FE0E" ; //This will disable Emoji character mapping and will display the proper unicode character, the black up arrow here.
NSString *strLess = @"\u2B07\U0000FE0E" ; //This will disable Emoji character mapping and will display the proper unicode character, the black down arrow here.

让我知道这是否有效!

第二次更新:

很高兴它成功了!在确保它有效之前不想参考。显然,这是在 Apple 的开发者论坛中针对付费开发者的。 this linkthis question 也提到过。

【讨论】:

  • 感谢截图。但在 Character Viewer 中,它也显示了我当前使用的相同符号。
  • 对不起,我现在在一台糟糕的 Windows 机器上,这就是为什么我不能自己检查它的原因。查看更新后的答案。
  • 感谢 Neeku 提供更新的答案。这非常有效:) 非常感谢。只是出于好奇,你告诉我if you add \U0000FE0E to your unicode, that'll avoid the Emoji.-你在哪里找到这个?你能分享我需要学习的链接吗:)
  • 当然!你去看看答案的另一个更新!
  • 不确定为什么所有这些示例都使用宽 Unicode 转义 \U,这个变体选择器是一个 BMP 字符,应该可以简单地作为 \uFE0E 访问。
猜你喜欢
  • 1970-01-01
  • 2013-06-05
  • 2012-08-03
  • 2015-12-12
  • 1970-01-01
  • 1970-01-01
  • 2013-05-15
  • 2016-01-10
  • 2013-11-18
相关资源
最近更新 更多