iOSAppDev
iOSAppDev

Reputation: 2783

Unicode symbol for BOLD arrow shows incorrect UI in UILabel iOS 7

I am using unicode symbol for BOLD up & down arrow from this link http://en.wikipedia.org/wiki/Miscellaneous_Symbols_and_Arrows

But its showing blue box around the arrow as shown in below screenshot

enter image description here

My code is as below

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

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

Can anybody tell me what is going wrong ?

Upvotes: 1

Views: 2133

Answers (1)

Neeku
Neeku

Reputation: 3653

The arrow with the blue box around it, is the Emoji arrow with the same Unicode. Open Character Viewer on OS X (Control + Option + Space) to look up the codes and check the Unicode for the Arrows section from the left pane. Using that unicode should fix the issue as it won't mess with the Emoji arrow codes!

Update Sorry, I don't have access to a Mac at the moment, therefore I couldn't look up the code myself. Apparently if you add \U0000FE0E to your unicode, that'll avoid the Emoji. So in your case:

Instead of:

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.

Write:

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.

Let me know if that works!

Second Update:

Glad it worked! Didn't want to reference before making sure it works. Apparently this is mentioned in Apple's Developer forum for the paid developers. It's also mentioned in this link and this question.

Upvotes: 4

Related Questions