views:

756

answers:

5

Hi, Does any one know how to display the copyright icon in UILabel text? This is the icon with a circle around c. The html code for it is: © or ©.

I tried the following code:

UILabel *contactInfo = [[UILabel alloc] initWithFrame:CGRectMake(-55,135,420,100)];
contactInfo.text = @"'©):'2009 Nationwide ";

or

contactInfo.text = @"'©'2009 Nationwide ";

or

contactInfo.text = @"©2009 Nationwide ";

It just prints everything as text and no icon.

This would work in a webView but I need it as UILabel text. Any help?

+1  A: 

In interface builder try option and c together.

JoePasq
+2  A: 
Pascal
+1  A: 
Dave Hinton
+1  A: 

Another way to insert symbols without dealing with your source files' character encoding is to encode them as UTF-8 bytes using \x escapes.

According to Fileformat.info, the Copyright sign in UTF-8 bytes is 0xC2 0xA9.

So this works: @"\xC2\xA9 Nationwide"

That's how I do all of mine.

Marco
A: 

It's usually not a great idea to put non-ASCII strings through the compiler. The UTF-8 approach is thus better, if unreadable. You could use

NSLocalizedString(@"copyright", @"");

and then a .strings file with

copyright = "©2009";

would be a lot easier to generalize to other non-ASCII strings.

(BTW, it's option + g, not option + c.)

David Dunham