Husein Behboudi Rad
Husein Behboudi Rad

Reputation: 5462

UITextview shows text Arabic but numbers English

I want to show some Arabic text and the number of UISlider Value in a uitextview for example:

مقدار= ۴۰

I am using this code:

 self.MyTextView.text= [NSString stringWithFormat:@"%f", self.mySlider.value];

UITextView shows the Arabic text correct but the value is adding with English characters. How can I concatenate the slider value so that uitextview show them with Arabic characters too.

Upvotes: 1

Views: 320

Answers (1)

ujell
ujell

Reputation: 2792

You should use NSNumberFormatter.

NSNumberFormatter* formatter = [NSNumberFormatter new];
[formatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"ar"]];

textView.text = [formatter stringFromNumber: @(slider.value)];

Upvotes: 3

Related Questions