我已经使用How to populate UITableView from the bottom upwards? post将tableview和tableview单元格转换为从下到上填充单元格。
但是我也想把swipe转换为Delete选项。更多细节请参考图片。

您可以看到Delete选项不是转换为tableview。任何有帮助的回答都将不胜感激。
发布于 2019-11-26 11:50:34
第一个反向UITableView在viewDidLoad中的应用
override func viewDidLoad() {
super.viewDidLoad()
tableView.transform = CGAffineTransform(scaleX: 1, y: -1)
}然后在cellForRowAt中反转单元格。
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "MyTableViewCell", for: indexPath) as? MyTableViewCell else { fatalError() }
cell.transform = CGAffineTransform(scaleX: 1, y: -1)
cell.contentView.transform = CGAffineTransform(scaleX: 1, y: -1)
return cell
}
func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
let delete = UITableViewRowAction(style: .default, title: nil) { (action, indexPath) in
// delete item at indexPath
}
let label = UILabel(frame: CGRect(origin: CGPoint(x: 0, y: 0), size: CGSize(width: 75, height: tableView.rectForRow(at: indexPath).height)))
label.numberOfLines = 0
label.textAlignment = .center
label.textColor = UIColor.white
label.backgroundColor = UIColor.red
label.text = "Delete"
UIGraphicsBeginImageContextWithOptions(label.bounds.size, false, 0.0)
label.layer.render(in: UIGraphicsGetCurrentContext()!)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
if let cgImage = image?.cgImage {
let rotada3 = UIImage(cgImage: cgImage, scale: image!.scale, orientation: .downMirrored)
delete.backgroundColor = UIColor(patternImage: rotada3)
}
return [delete]
}在editActionsForRowAt上,我做了一项工作,用镜像文本打印图像
发布于 2019-11-26 13:27:35
变换表视图
tableView.transform = CGAffineTransform(rotationAngle: -(.pi))然后在细胞内
cell.transform = CGAffineTransform(rotationAngle: .pi)https://stackoverflow.com/questions/59049627
复制相似问题