2

I'm struggling since long time to achieve this,i.e., I want to create a custom tableview cell for English(LTR) and Arabic(RTL), screen 1 for English language screen 2 for Arabic language

Please help me how to achieve this.

I'm a Learner
  • 193
  • 1
  • 2
  • 15

1 Answers1

2

First create 2 different tableview cell as you mentioned in the screen shots. Second, I think you are managing app localization. Take a global bool variable like flagIsEnglish, now set this flag whenever you change the language. Now when come to tableview, you are managing cell or accessing custom cell object. Here you will manage condition like this:

// cellForRowAtIndexPath

if(flagIsEnglish) {
  cell = NSBundle.mainBundle().loadNibNamed("EnglishCell", owner: self, options: nil)![0] as! (CustomViewCell)
} else { 
  cell = NSBundle.mainBundle().loadNibNamed("ArabicCell", owner: self, options: nil)![0] as! (CustomViewCell)
}

This flag is play important role as you will get you expected output when you will implement this.

Gourav Joshi
  • 2,419
  • 2
  • 27
  • 45