Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
315 views
in Technique[技术] by (71.8m points)

ios - Getting a normal looking unicode down arrow in a UILabel like this ?

I would like to get a down arrow to display inside a UILabel. Specifically ? Unicode: U+2B07. This is show sort order on a column header.

I have seen the code to get unicode characters to display and when I use it for the symbol above it doesn't display as expected but rather comes up with a blue down arrow with gloss.

Has anyone seen this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Displaying some characters as "Emojis" is a feature which is e.g. (controversially) discussed here: https://devforums.apple.com/message/487463#487463 (requires Apple Developer login). This feature was introduced in iOS 6.

A solution (from https://stackoverflow.com/a/13836045/1187415) is to append the Unicode "Variation selector" U+FE0E, e.g.

self.myLabel.text = @"u2B07uFE0E";
// or:
self.myLabel.text = @"?uFE0E";

Note that on iOS <= 5.x, the Variation selector is not necessary and must not be used, because iOS 5 would display it as a box.

In Swift it would be

myLabel.text = "?u{FE0E}"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...