我试图在我的 iOS 应用程序中创建一个 cardview 效果,似乎工作正常,除了当应用程序运行时,tableview 单元格比预期的要小得多,我不知道为什么。单元格的高度设置为 75,用于 cardview 的 uiview 正确连接到它的 super View 。由于某种原因,这会切断单元格的下半部分,其中包含出生日期和邮政编码等重要信息。
最佳答案
如果您确实设置了单元格高度,则无法根据您发布的内容判断。它似乎缺少您想要的正确高度。 为此,您使用:
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
//for example if you want a fixed size
//here you can also do some math and apply a percentage of the screen height depending of the iPhone version.
return 75
}
关于ios - Uitableviewcell 具有自定义 View ,在应用程序运行时无法正确调整大小(下图),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45384203/