【发布时间】:2019-07-16 14:39:33
【问题描述】:
我有一个带有部分的 UITableView。我在每个单元格中添加了一个 UImage,但它在左侧,如何更改它以使其转到右侧?
这是每个单元格的代码:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cells")
cell?.textLabel?.text = data[indexPath.section].subType[indexPath.row]
cell?.textLabel?.textAlignment = .right
cell?.textLabel?.font = UIFont(name: "GESSTwoLight-Light", size: 15)
cell!.isUserInteractionEnabled = false;
cell!.imageView?.image = UIImage(named: "username.png")
return cell!
}
【问题讨论】:
-
你可以做的是创建一个tableView自定义单元格并按照你的意愿设计它