簡體   English   中英

如何調試自動布局約束?

[英]How to debug AutoLayout Constraints?

我是iOS開發的新手。 每當我運行我的應用程序時,都會收到此沖突的約束錯誤。 您能建議我一些有關如何調試此問題的信息嗎?

2016-07-13 12:53:51.186 Calculator[4458:50017] 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. 
(
    "<_UILayoutSupportConstraint:0x7fcaf3c5e670 V:[_UILayoutGuide:0x7fcaf3c62a80(0)]>",
    "<_UILayoutSupportConstraint:0x7fcaf3c5c060 _UILayoutGuide:0x7fcaf3c62a80.bottom == UIView:0x7fcaf3c54390.bottom>",
    "<NSLayoutConstraint:0x7fcaf3c54b00 UIImageView:0x7fcaf3c54c70.width == UIImageView:0x7fcaf3c54c70.height>",
    "<NSLayoutConstraint:0x7fcaf3c633d0 V:|-(0)-[UIImageView:0x7fcaf3c54c70]   (Names: '|':UIView:0x7fcaf3c54390 )>",
    "<NSLayoutConstraint:0x7fcaf3c63420 H:[UIImageView:0x7fcaf3c54c70]-(0)-|   (Names: '|':UIView:0x7fcaf3c54390 )>",
    "<NSLayoutConstraint:0x7fcaf3c63470 H:|-(0)-[UIImageView:0x7fcaf3c54c70]   (Names: '|':UIView:0x7fcaf3c54390 )>",
    "<NSLayoutConstraint:0x7fcaf3c63560 V:[UIImageView:0x7fcaf3c54c70]-(0)-[_UILayoutGuide:0x7fcaf3c62a80]>",
    "<NSLayoutConstraint:0x7fcaf3c67e50 'UIView-Encapsulated-Layout-Height' V:[UIView:0x7fcaf3c54390(736)]>",
    "<NSLayoutConstraint:0x7fcaf3c61230 'UIView-Encapsulated-Layout-Width' H:[UIView:0x7fcaf3c54390(414)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7fcaf3c54b00 UIImageView:0x7fcaf3c54c70.width == UIImageView:0x7fcaf3c54c70.height>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.

似乎您添加了一個約束,該約束正在被另一個約束抵消。

通常,如果您單擊右鍵,則可以使用“建議的約束”,然后嘗試使用它們,看看它是否有效!

編輯: 在此處輸入圖片說明

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM