虽然我专门为 View 设置了高度,但 View 仍然被切断。原型(prototype)单元格 View 高度已设置为 300,内容 View 和 ImageView 也设置为(稍小)。
知道为什么吗?谢谢。
以下是屏幕截图:
最佳答案
由于您使用的是原型(prototype)单元,我假设您使用动态单元。
UITableView 的行高属性始终会覆盖动态单元格的单元格内容高度。因此,实现相应的委托(delegate)方法 heightForRowAtIndexPath:
或通过设置 UITableView
的行高来设置 Storyboard 中的行高。
Swift 3 委托(delegate)方法:
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 300.0;
}
关于ios - 不应用表格 View 单元格高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40082487/