Twinkle
Twinkle

Reputation: 430

localization for Arabic / Autolayout

I shocked when I run my app in device (which its language is Arabic) that objects suppose to be to right direction are get to left and vide versa.

I realised later that the auto layout with Arabic localisation causes this problem.

I set auto layout programmatically as following:

    [cell.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[labelView(>=100)]-[cellImage(154)]|"
options:0
metrics:nil
views:dics]];


 [cell.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[labelView]"
options:0
metrics:nil
views:dics]];

            [cell.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[cellImage]|"
 options:0                                                                                     metrics:nil
 views:dics]];

I am using Base storyboard . how can I fix the orientation for English and Arabic thanks in advance

Upvotes: 1

Views: 739

Answers (1)

Twinkle
Twinkle

Reputation: 430

I solved the problem of orientation for Arabic language simply by adding

NSLayoutFormatDirectionLeftToRight

as a parameter for options of the constraint

Upvotes: 1

Related Questions