I develop an iOS application and my native language is Persian (a Right-to-Left language). How can I change UITableView direction to right-to-left in iOS programming?
A UITableView with RTL direction has:
like this :
Is there any UI or programming way to do this?
我知道它会自iOS8以来自动改为从右到左。
You can try to do this as well
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = myTableView.dequeueReusableCellWithIdentifier("cell")! as UITableViewCell
cell.textLabel?.textAlignment = .Right
cell.textLabel?.text = goalsArray[indexPath.row]
return cell
}
for me this way worked
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = self.tableView.dequeueReusableCell(withIdentifier: cellReuseIdentifier)! as UITableViewCell
//cell.myView.backgroundColor = self.colors[indexPath.row]
cell.textLabel?.text =
"\((self.FAQs?[indexPath.row].Question)!)"
cell.textLabel?.textAlignment = .right
return cell
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.