我无法设法让我的文本对齐到我的表视图的右侧。我的代码将文本对齐设置为正确,但只有当该行多出一行时才能证明文本正确。这是我的cellforRowAt代码textAlignent在Swift 3.0的cellForRowAt中的右边
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = UITableViewCell(style: .subtitle, reuseIdentifier: cellId)
cell.textLabel?.text = self.messages[indexPath.row]
cell.textLabel?.numberOfLines = 0
cell.textLabel?.textAlignment = .right
return cell
}
我该如何解决这个问题?