Paul Reed
Paul Reed

Reputation: 113

How do I display the character for 1/2 in an NSString in iOS?

I'm working on an application for iOS in which I would like to place the fractional value 1/2 as a single character within an NSString for use in an UILabel, is this possible?

Upvotes: 0

Views: 1291

Answers (2)

Cyrille
Cyrille

Reputation: 25144

You can simply use Mac OS's built-in character viewer: http://docs.info.apple.com/article.html?path=Mac/10.6/en/8164.html

So you can just do label.text = @"½"

Upvotes: 2

Try setting the label's text property to the Unicode of 1/2:

label.text = [NSString stringWithFormat:@"%C",0x00bd];

Upvotes: 2

Related Questions