Reputation: 936
Problem: Text (Hebrew language) which I set in button shows conversely.
For example:
NSString *title = @"עמוד הבית"; //This is right-to-left
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setTitle:title forState:UIControlStateNormal];
so: In my simulator i see:
//This is left-to-right
How can it fix?
How can I show text correctly?
App supported iOS 6 and iOS 7
Upvotes: 3
Views: 952
Reputation: 3396
What worked for me when using an UIButton was this:
if ([UIView userInterfaceLayoutDirectionForSemanticContentAttribute:button.semanticContentAttribute] == UIUserInterfaceLayoutDirectionRightToLeft)
{
button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
}
Links worth reading:
Supporting Right-to-Left Languages (Apple Reference)
AutoLayout + RTL + UILabel text alignment
Upvotes: 2
Reputation: 5060
if you use "#x200F" that will solve your problem,add this as appended string.There is one issue is after adding it all come with and that's weird,if you know the answer.Please, share
Upvotes: 0