2

I have an iOS Application which i has 2 languages Arabic/English , Arabic language is an RTL Language so when i switch language to Arabic the app running with RTL Layout And that's working

I am just need to force an UIImageView to be LTR when the whole layout is RTL so i used this piece of code :

class HomeViewController: UIViewController {
@IBOutlet weak var userImage:UIImageView! 


override func viewDidLoad()
{
super.viewDidLoad()

    self.userImage.semanticContentAttribute = .forceLeftToRight
}


}

but it's not working and the UIImageView Still in right position

any help how can i do that ?

Here's a screenshot from my simulator i need to make the image in NavigationController in Left position

enter image description here

Muhammed
  • 584
  • 1
  • 11
  • 24

2 Answers2

1

First open your storyboard in XML (Source code) then

Search for leading (in Constraints) and replace it with left and same
Search for trailing (in Constraints) and replace it with right

second options is use semantic property

enter image description here

if you doing with label text then here is my question

Combine Two Language Text RTL & LTR

Hope it is helpful to you

Prashant Tukadiya
  • 15,838
  • 4
  • 62
  • 98
0

If using auto layout constraints:

1- Double Trailing or Leading constraint of the view

2- Click "First Item" drop down menu

3- Uncheck "Respect language direction"

4- You might need to do step 2 and 3 for "Second Item" as well.

You need to do this for all views with Trailing and Leading constraints to replace them with right and left constraints.

fullmoon
  • 8,030
  • 5
  • 43
  • 58