【问题标题】:How to remove imageView from tableview's cell, and reset the cell's height如何从 tableview 的单元格中删除 imageView,并重置单元格的高度
【发布时间】:2015-06-05 07:18:14
【问题描述】:

我在我的自定义单元格中使用自动布局和约束,包括 imageView,UILabelUILabel 可以自动调整内容高度(我使用UITableViewAutomaticDimension)。

现在我想删除demo中的cellimageView(我设置imageView nil),我可以这样做,但是我不能将cell的高度改小。我该怎么办,非常感谢。

【问题讨论】:

  • 您是否尝试过在索引路径重新加载单元格?
  • 如何删除 imageView?你在改变它的框架吗?
  • @UtsavParikh 我设置 imageview 等于 nil

标签: ios uiimageview autolayout tableview


【解决方案1】:

你可以重写 UITableView 函数

func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
    return 65.0
}

【讨论】:

  • 我恐怕不能用这个,因为我的标签高度不能固定
  • 但是你可以设置一个条件来返回不同的值
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-03-05
  • 2018-09-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多