Wednesday, April 6, 2011

UILabel and right to left text

I have a collection of NSString objects that contain arabic text. However, when I try to display any of them using a UILabel, the text shows left-to-right instead of right-to-left (NSLog shows the strings properly)

I am thinking about a work-around, applying a transform to the UILabel to make a y-axis symmetry, but how can I detect if a NSString contains a RTL string?

From stackoverflow
  • Have you tried setting your region to Arabic? I would have thought this type of thing would be handled automatically.

    : Thanks Andrew The problem is that I can not force the users to change their region. And it should be automatically handled, as it is in OS X, but...
  • Try prepending the unicode character 0x200F to the beginning of each string. This character is an invisible marker character that indicates text directionality.

0 comments:

Post a Comment