ICL1901
ICL1901

Reputation: 7778

iOS - How can I put special characters (music notation) in a UILabel?

I would like to create a label with some unicode text and a music note. The notes are shown below:

enter image description here

I have tried:

titleLabel.text = @" title + ♫";

but that results in:

enter image description here

I must be doing something dumb.. Any advice welcome.

Upvotes: 0

Views: 728

Answers (2)

Tore Olsen
Tore Olsen

Reputation: 2183

The number column in your table actually contains HTML/SGML/XML entities with decimal values. A unicode escape sequence in NSString takes the hexadecimal value, so your note ♫ would be the hex value 0x266b to be used like this

titleLabel.text = @" title \u266b";

Upvotes: 1

antonio
antonio

Reputation: 732

Hit cmd+cntrl+space in Xcode, and search for 'note'. There are some u may use. Just double click one and it will be written where your cursor is in the code.

Upvotes: 0

Related Questions