【发布时间】:2019-09-13 05:25:03
【问题描述】:
我在 UITableViewCell 中的项目中添加了自动布局,但出现未知错误。
使用 AutoLayout 添加的所有项目都将对齐到左上角。
其他项目也是如此。
如果我将自动布局添加到 General、Total、Final Label :
没有与约束相关的代码。 UITableviewCell 也没有代码。
在视图控制器中:
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "ProcDetailMoreCell", for: indexPath) as! ProcDetailMoreCell
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return CGFloat(175)
}
我不知道为什么会这样。请帮我看看为什么会出现这些结果。
【问题讨论】:
-
发生这种情况时,切换到 Xcode 并打开 View Debugger。有感叹号吗?这些会告诉你在运行时你的约束有什么问题。
-
没有感叹号。一切都应该完美运行,但我不知道为什么。
-
添加与 $9999 相同的一般标签约束
标签: ios swift uitableview constraints