gpt4 book ai didi

iOS:在 segue 中无法同时满足约束

转载 作者:行者123 更新时间:2023-12-01 18:56:34 25 4
gpt4 key购买 nike

我正在尝试从 tableview 到 UIViewController 进行 segue,但我遇到了一个奇怪的错误。即使目标 View 完全为空,只是添加到 Storyboard 中,也会发生错误。我的想法是发送 View 的某些元素触发了错误,但我很困惑为什么这仅在退出该 TableViewController 时显示,而不是在最初加载它时显示。

这是错误的堆栈跟踪:

Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2014-10-14 00:52:23.472 Phood[54950:70b] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0x9d56270 H:[PHStarsView:0x9d9c4a0(70)]>",
"<NSLayoutConstraint:0xf544940 H:|-(20)-[PHStarsView:0x9d9c4a0] (Names: '|':UITableViewCellContentView:0x9fcd710 )>",
"<NSLayoutConstraint:0xf543d90 H:[PHStarsView:0x9d9c4a0]-(80)-| (Names: '|':UITableViewCellContentView:0x9fcd710 )>",
"<NSAutoresizingMaskLayoutConstraint:0x9d774e0 h=--& v=--& H:[UITableViewCellContentView:0x9fcd710(320)]>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x9d56270 H:[PHStarsView:0x9d9c4a0(70)]>

最佳答案

我在使用自定义 UITableViewCell Nib 时遇到了同样的问题。关于解除分配单元格的事情会打破约束。

尝试添加

- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return UITableViewAutomaticDimension;
}

关于iOS:在 segue 中无法同时满足约束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26355770/

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