Reputation: 1232
Hi I'm trying to put an arrow into a UILabel's text but it is not working. I'm trying the following code
NSString *labeltext = @"➜";
label.text = labeltext;
But that makes the app crash!
(if you go to the edit menu and go to special characters then it is the 10th rightwards arrow)
.
Thanks for your help in advance
Upvotes: 4
Views: 7779
Reputation: 12671
Code should be working by just writing the special character directly in the code as written in the question also
label.text=@"➜";
but in case it is not working then there are alternative ways to print the special characters in IOS, You need to use Unicode character of this sign , check out this page codes and after getting the code just do like as follows
UniChar ucode = 0x2794;
NSString *codeString = [NSString stringWithCharacters:&ucode length:1];
[label setText:codeString];
OR Just write directly like as follows
label.text=@"\u2794"; // this is the unicode for right arrow
in Swift:
lable.text="\u{2794}"
Upvotes: 15