【发布时间】:2018-11-16 20:39:45
【问题描述】:
我必须创建一个 UITableView 单元,其中有一条“线”通过。你们知道怎么做吗?这将是一个价格标签,所以我想说:“旧价格,现在有 50% 的折扣”。所以,“旧价格”应该被跨越。
界面代码
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "topSoldCell", for: indexPath) as! TableViewCell
let content = self.dataTopSold[indexPath.item]
cell.labelNomeTopSell.text = content.nome
cell.imageViewTopSell.setImage(url: content.urlImagem, placeholder: "")
cell.labelPrecoDe.text = "R$ \(content.precoDe)"
cell.labelPrecoPor.text = "R$ 119.99"
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
performSegue(withIdentifier: "segueId", sender:self.dataTopSold[indexPath.row])
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "segueId" {
let des = segue.destination as! TelaDetalheProdutos
des.stringNomeeDesc = sender as! Top10
}
}
【问题讨论】:
-
显示一些用户界面或代码
-
我已经尝试了这篇文章的所有方法。但是,一旦我想要它在我的 UITableview Cell @AkshaysinghYaduvanshi 上,它们都不适合我
-
@Anbu.karthik 你好!我刚刚更新了包含 UICode 的帖子。请检查一下好吗?
标签: ios swift uitableview uilabel