ios - TableView 单元格行高不起作用

标签 ios swift uitableview row-height

enter image description here

我曾尝试对表格 View 单元格中的行高进行硬编码。运行程序后,它看起来只有一行。我怀疑这是因为表格 View 行的高度。

你能告诉我这里出了什么问题吗?

最佳答案

Xcode 9 中,tableview 根据 Autolayout 自动创建预估单元格。由于您没有提供自动布局,这就是您得到这个的原因。

您需要通过选择 tableview 并取消选中这两个选项来禁用估计和自动单元格大小:

enter image description here

给行高你想要的值,单元格将相应地创建。

希望对您有所帮助。

关于ios - TableView 单元格行高不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46519567/

相关文章:

ios - 在 UITableView 之上为 UIView 添加阴影

ios - 连接到 iBeacon

iOS 警报行为与相同的 APNS 消息不一致

iPhone:获取结果 Controller ,不要使用 UITableView 中的部分

javascript - 防止 iOS WebApp 中的水平滚动

ios - NSString 编码在 url 内容上返回 nil

swift - swift 中的运算符或方法,作为 python 的海象运算符

ios - 缓慢的动画 Action

IOS13+ NSPersistentCloudKitContainer UIRefreshControl 如何刷新UITableView内容

ios - 部分显示 UITableViewController 就像 Facebook iPhone 应用程序