iOS:在segue中无法同时满足约束 [英] iOS: Unable to simultaneously satisfy constraints when in segue

查看:111
本文介绍了iOS:在segue中无法同时满足约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将一个segue从tableview变成一个UIViewController,但我得到了一个奇怪的错误。即使目标视图完全为空,也会发生错误,只是添加到故事板。我的想法是发送视图的一些元素是触发错误,但我很困惑,为什么这只是在退出TableViewController时显示,而不是最初加载时。

I am trying to make a segue from a tableview into a UIViewController, but I'm getting a curious error. The error occurs even if the target view is completely empty, just added to the storyboard. My thought is some element of sending view is triggering the error, but I am confused why this is only showing when exiting that TableViewController, not when loading it initially.

这是堆栈跟踪形成错误:

This is the stack trace form the error:

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笔尖相同的问题。关于解除分配细胞的事情会破坏约束。

I ran into the same problem with a custom UITableViewCell nib. Something about deallocating the cell breaks constraints.

尝试添加

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

这篇关于iOS:在segue中无法同时满足约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆