Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xcode 如何正确设置此布局的约束?_Xcode_User Interface_Constraints - Fatal编程技术网

Xcode 如何正确设置此布局的约束?

Xcode 如何正确设置此布局的约束?,xcode,user-interface,constraints,Xcode,User Interface,Constraints,我已经尝试了很长一段时间了,但是由于约束问题,我一直在崩溃 如何设置此布局,使其在iPhone3GS、4和5以及iPad上工作 _______TOP OF SCREEN________ Table View should attach to top of screen and with 5 pixels to the Label below flexible in height so it works on iPhone 5 and 6 ________________________

我已经尝试了很长一段时间了,但是由于约束问题,我一直在崩溃

如何设置此布局,使其在iPhone3GS、4和5以及iPad上工作

_______TOP OF SCREEN________



Table View should attach to top of screen and with 5 pixels to the Label below
flexible in height so it works on iPhone 5 and 6


____________________________


Label with fixed distance to table View above and button below

____________________________

Button with fixed distance to Label above and fixed distance to bottom of screen

____________________________
      Bottom of screen
所以基本上所有的距离和高度都是固定的,除了桌子的高度,它应该填满屏幕顶部和标签之间的任何可用部分

每当我这样设置contstraint时,我总是会在使用iOS 6.1的iPhone 3上崩溃:

 2013-03-16 23:12:51.013 BMWhat Test[64196:907] 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) 
(
    "<NSAutoresizingMaskLayoutConstraint:0x1d1f2d70 h=-&- v=-&- UIView:0x1d1aac20.height == UITransitionView:0x1d174220.height - 20>",
    "<NSLayoutConstraint:0x1d1c03b0 V:[UILabel:0x1c58f100(21)]>",
    "<NSLayoutConstraint:0x1d1ce780 V:[UITableView:0x1cbd9000(469)]>",
    "<NSLayoutConstraint:0x1c5aff30 V:[UIButton:0x1d1d1bb0(44)]>",
    "<NSLayoutConstraint:0x1d1c0030 V:|-(0)-[UITableView:0x1cbd9000]   (Names: '|':UIView:0x1d1aac20 )>",
    "<NSLayoutConstraint:0x1d1921d0 V:[UILabel:0x1c58f100]-(1)-[UIButton:0x1d1d1bb0]>",
    "<NSAutoresizingMaskLayoutConstraint:0x1c58e4d0 h=--- v=--- V:[UIWindow:0x1d002230(480)]>",
    "<NSLayoutConstraint:0x1d1cd6c0 V:[UITableView:0x1cbd9000]-(NSSpace(8))-[UILabel:0x1c58f100]>",
    "<NSLayoutConstraint:0x1d1ca370 V:[UIButton:0x1d1d1bb0]-(5)-|   (Names: '|':UIView:0x1d1aac20 )>",
    "<NSAutoresizingMaskLayoutConstraint:0x1d172a90 h=--& v=-&- UITransitionView:0x1d174220.height == UIWindow:0x1d002230.height>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x1d1ce780 V:[UITableView:0x1cbd9000(469)]>

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.
2013-03-16 23:12:51.013 BMWhat Test[64196:907]无法同时满足约束条件。
可能下面列表中至少有一个约束是您不想要的。试着这样做:(1)看看每个约束,试着找出你不期望的约束;(2) 找到添加了不需要的约束的代码,然后修复它。(注意:如果您看到不理解的NSAutoresizingMaskLayoutConstraints,请参阅UIView属性TranslatesAutoResizingMaskToConstraints的文档)
(
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
)
将尝试通过打破约束进行恢复
在objc_异常_抛出时中断,以便在调试器中捕获该异常。
中列出的UIView上UIConstraintBasedLayoutDebugging类别中的方法也可能会有所帮助。

在模拟器iPhone Retina 4英寸iOS 6上工作正常。

NSLayoutConstraint仅在iOS 6中受支持


iPhone3不支持iOS 6。3Gs是最早的型号。

NSLayoutConstraint仅在iOS 6中受支持


iPhone3不支持iOS 6。3Gs是最早的型号。

问题是您在tableview上指定了一个垂直约束,将其高度绑定到469 pt。因为您希望该tableview的高度具有灵活性,所以不需要该约束

问题在于,您在tableview上指定了一个垂直约束,将其高度绑定到469磅。因为您希望该tableview的高度具有灵活性,所以不需要该约束

谢谢你指出这一点-我指的是3Gs。问题更多的是如何执行约束本身,使其不会崩溃。无论如何,我刚刚意识到,在手机本身上——没有连接到调试器——这并不重要,因为它不会崩溃。也许这就是路?只要它在电话上表现良好,人们就不会关心恢复的崩溃:-)谢谢你指出这一点-我是说3Gs。问题更多的是如何执行约束本身,使其不会崩溃。无论如何,我刚刚意识到,在手机本身上——没有连接到调试器——这并不重要,因为它不会崩溃。也许这就是路?只要它在电话上表现良好,人们就不会关心恢复的崩溃:-)完美-谢谢你的帮助!顺便问一下,有没有办法在运行前检查这些约束问题,并以更好的方式显示它们?我认为这些工具还不支持这一点。约束的解决方案最终取决于运行时实际窗口的大小和方向,因此我不确定这些工具在编译时检测问题的完整性。但在运行时,您确实会遇到类似于您所看到的异常,并且您还可以在运行时检查不明确的约束。在花费了大量时间之后,高度正好与约束冲突。非常感谢!太好了-谢谢你的帮助!顺便问一下,有没有办法在运行前检查这些约束问题,并以更好的方式显示它们?我认为这些工具还不支持这一点。约束的解决方案最终取决于运行时实际窗口的大小和方向,因此我不确定这些工具在编译时检测问题的完整性。但在运行时,您确实会遇到类似于您所看到的异常,并且您还可以在运行时检查不明确的约束。在花费了大量时间之后,高度正好与约束冲突。非常感谢!