我有一个正在运行的应用,我正在尝试添加RTL语言支持。
我使用AppDelegate
中的以下行在开始后执行,特别是在didFinishLaunchingWithOptions
中。
UIView.appearance().semanticContentAttribute = .forceRightToLeft
它在iOS 10上完美运行,但现在在iOS 11上,默认的tableView单元格的标签仍然是LTR对齐。
答案 0 :(得分:2)
您还应将标签的语义内容属性设置为.forceRightToLeft
。
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: <your cell ID>, for: indexPath)
cell.textLabel?.semanticContentAttribute = .forceRightToLeft
return cell
}