4

I am going to develop the iPhone app. But I got stuck with one place. I want to write some symbol on the label from the xib file.

The symbols are not on the keyboard but we can get it by the ASCII value.

e.g: the ACSII value for the character sign "mue" is 230 but how to print that symbol "mue" on the label that i dont know.

So please help me for that.

Thanks in advance.

mattjgalloway
  • 34,792
  • 12
  • 100
  • 110
Shreyash Mahajan
  • 23,386
  • 35
  • 116
  • 188

7 Answers7

3

Pressing Cmd+Ctrl+Space will open a special characters menu. Check if the desired symbol is present. If it isn't, click the gear icon, then select the desired category — add it to the list.

See screenshot below

Ranjith
  • 425
  • 6
  • 8
3

Use whatever editor you like to produce that character, and open your xib in XCode and just copy/paste it in?

Clafou
  • 15,250
  • 7
  • 58
  • 89
3

Use NSUTF8StringEncoding to encode your string.

For example,

NSString *str = [NSString stringWithUTF8String:"your string for encoding"];

[lblName setText:str];

Following function will also help :

- (NSString *) decodedString:(NSString *) originalString {
    NSString *newString = [NSString stringWithUTF8String:[originalString cStringUsingEncoding:[NSString defaultCStringEncoding]]];
    return newString;
}

I suggest to use above function.

Devang
  • 11,258
  • 13
  • 62
  • 100
  • Thanks for the Answer. But i want to show it in to the Label text. – Shreyash Mahajan Mar 27 '12 at 09:52
  • I have accepted the answer. And that one is the Simplest way to do it. Thanks for the Answer. – Shreyash Mahajan Mar 27 '12 at 10:00
  • @Devang Your solution was good and it working fine. But In my project I we are enter text in arabic language. And if we encode and decode text the arabic text was not display. are you have any idea to resolve it .. – MinuMaster Jun 03 '15 at 14:16
2

Open the "Special Characters"-Panel and search for your character. You can find it at the bottom of the edit menu. There is a shortcut for it too, cmd+opt+t

Copy and paste your character from there to your UILabel.

and btw: option + m = µ

Matthias Bauch
  • 89,811
  • 20
  • 225
  • 247
2

I think you mean the character 'µ', yes?

If so, you can simply type it into the label by clicking "option" and "m" on your Macintosh keyboard, when you are editing the label in your XIB.

Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
2

If you can use the unicode number instead, you can do it like this:

NSString *muString = [NSString stringWithFormat:@"%C", 0x03BC];

Write 0x then the unicode number.

nevan king
  • 112,709
  • 45
  • 203
  • 241
2

You can simply type into label by using 'Alt' key + 'm' key on key board, when you are editing the label in your XIB and rest of symbols, you can get easily using 'Alt' key and other keys. You can fix 'Alt' key and change other keys(one by one).

Prasad G
  • 6,702
  • 7
  • 42
  • 65