gpt4 book ai didi

ios - 开启Auto Layout时Assertion Fail如何解决?

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

我得到:

Assertion failure in -[Cell layoutSublayersOfLayer:], /SourceCache/UIKit_Sim/UIKit-2372/UIView.m:5776
2013-01-06 14:58:42.951 Likely[4588:c07] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. Cell's implementation of -layoutSubviews needs to call super.'

我写道:

-(void)layoutSubviews{
[super layoutSubviews];
}

在 Cell.m 文件中。但不起作用。我能做什么?

最佳答案

您可以尝试在调用 super 之后添加。

[self layoutIfNeeded];

这将导致:

- (void)layoutSubviews
{
[super layoutSubviews];
[self layoutIfNeeded];
}

关于ios - 开启Auto Layout时Assertion Fail如何解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14182449/

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