为什么我的模拟会以编程方式获得与锚点/约束有关的空白黑屏?

时间:2016-12-08 17:12:08

标签: ios swift xcode autolayout

这是我的代码。我试图将webView锚的顶部限制在视图控制器的顶部布局指南的底部,但我只是得到一个黑屏,有时控制台中的错误: < / p>

checkThisFilesHashEquals(originPathName)

代码 -

 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) 
(
    "<_UILayoutSupportConstraint:0x608000284d30 _UILayoutSpacer:0x6080001aa560'UIVC-topLayoutGuide'.height == 20   (active)>",
    "<_UILayoutSupportConstraint:0x6080002850a0 V:|-(0)-[_UILayoutSpacer:0x6080001aa560'UIVC-topLayoutGuide']   (active, names: '|':UIView:0x7fcfcac26cd0 )>",
    "<NSAutoresizingMaskLayoutConstraint:0x608000280fa0 h=--& v=--& WKWebView:0x7fcfcb09a400.midY == 0   (active)>",
    "<NSAutoresizingMaskLayoutConstraint:0x608000280ff0 h=--& v=--& WKWebView:0x7fcfcb09a400.height == 0   (active)>",
    "<NSLayoutConstraint:0x6080002846f0 V:[_UILayoutSpacer:0x6080001aa560'UIVC-topLayoutGuide']-(3)-[WKWebView:0x7fcfcb09a400]   (active)>",
    "<NSAutoresizingMaskLayoutConstraint:0x608000281220 h=--& v=--& 'UIView-Encapsulated-Layout-Top' UIView:0x7fcfcac26cd0.minY == 0   (active, names: '|':UIViewControllerWrapperView:0x7fcfcac08120 )>"
)

1 个答案:

答案 0 :(得分:0)

添加导航委托:

webView.navigationDelegate = self

然后听取错误和导航代表,你将能够看到真实或不发生的事情。