gpt4 book ai didi

ios - Storyboard中 UITableViewCell 的 backroundView 属性设置运行时错误

转载 作者:可可西里 更新时间:2023-11-01 06:16:22 26 4
gpt4 key购买 nike

在使用静态内容 TableView 的 Storyboard中。我添加了一个表格 View 单元格。我在其中添加了一个 View 和一个标签。当我将 View 分配为单元格的背景 View (ctrl+单击并从单元格拖动到 View )时,我在加载 tableview 后运行时遇到以下错误。

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. UITableViewCell's implementation of -layoutSubviews needs to call super.'

如果我删除关联,它会毫无问题地运行。

有没有人遇到过这个错误?

最佳答案

我猜测这是一个 View 被视为在 View 层次结构中包含两次的罕见情况。执行布局时,它会遍历普通 View 继承并布置 View ,但随后(或在此之前)它也会布置背景 View 层次结构。这将不得不导致布局错误。

解决方案?对着苹果吼叫,不理它。断开 View 与 backgroundView 属性的连接,仅将其作为 View 处理。这对我有用。我看不出连接它有什么很大的优势。

关于ios - Storyboard中 UITableViewCell 的 backroundView 属性设置运行时错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13090338/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com