【发布时间】:2020-05-27 18:48:41
【问题描述】:
尝试加载 VC 时出现以下错误:
Thread 1: Exception: "Unable to activate constraint with anchors
<NSLayoutXAxisAnchor:0x280fea300 \"i6.I6FuelSheetTextField:0x1030fe400.centerX\"> and
<NSLayoutXAxisAnchor:0x280fea440
\"UILayoutGuide:0x282327800'UIViewSafeAreaLayoutGuide'.centerX\"> because they have no common
ancestor. Does the constraint or its anchors reference items in different view hierarchies?
That's illegal."
如何识别这些地址所指的视图?
【问题讨论】:
-
如果您无法识别带有错误消息的视图(例如您显示的消息中的
FuelSheetTextField),您可能会发现尝试使用exerciseAmbiguityInLayout()会有所帮助
标签: swift xcode uiview autolayout