Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display the copyright icon in UILabel text?

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?

like image 779
Neeraj Avatar asked Oct 23 '09 16:10

Neeraj


People also ask

How do I add an icon to UILabel?

From there you can drag a UIImageView and UILabel into the view you just created. Set the image of the UIImageView in the properties inspector as the custom bullet image (which you will have to add to your project by dragging it into the navigation pane) and you can write some text in the label.

How do I change my UILabel text?

To change the font or the size of a UILabel in a Storyboard or . XIB file, open it in the interface builder. Select the label and then open up the Attribute Inspector (CMD + Option + 5). Select the button on the font box and then you can change your text size or font.

What is UI label?

A view that displays one or more lines of informational text.


2 Answers

If your source files are in UTF-8, what they should be, this should work just fine. Otherwise you should use .strings-files in combination with the NSLocalizedString() macro and put your text into UTF-16 files.

Works for me: myUILabel.text = @"© by me";

© by me
(source: hillrippers.ch)

Edit: Now that I see that you've tried to insert the symbol as HTML entity - this does not work, just insert the symbol as it appears.

like image 181
Pascal Avatar answered Sep 20 '22 14:09

Pascal


In interface builder try Option and G together.

If you don't have an Option key, try with ALT.

like image 43
JoePasq Avatar answered Sep 19 '22 14:09

JoePasq