franck franck - 16 days ago 5
iOS Question

weird formating in UITextView for Hebrew characters

I'm having a weird output inside my UITextView, when using hebrew characters, if I print it in the console i get something correct:

"אסף השמן said 13 hours ago:"

but when displayed inside my UITextView It gets printed like that:

UITextView output

Any idea ?

UITextView * textView = [[UITextView alloc] initWithFrame:CGRectMake(x, y , width, g.height)];
[textView setBackgroundColor:[UIColor clearColor]];
[textView setUserInteractionEnabled:NO];
[textView setFont:font];
[textView setTextColor:color];
[textView setTextAlignment:NSTextAlignmentRight];
[textView setText:textContent];

[scrollView addSubview:textView];

Answer

Hebrew is a right-to-left leading language, what begins at left in a latin language will begin at right in Hebrew. The text will be displayed at the right of your component if you choose a right-to-left leading language. Maybe the way you print the content does it the way you expect it to be, but in your screens it will be displayed in a right-to-left manner due to its format.

Comments