2015-06-21 34 views
0

在我的iPhone(iOS)應用程序中,我使用全屏圖像來顯示關於屏幕中不同選項的「幫助」。我將前導,頂部,尾部和底部約束常量設置爲「0」,指向超級視圖。這種情況在iPhone 4S,5/5C/5S,6和6+上運行良好,沒有任何問題。
現在點擊圖像視圖,我必須爲從右向左進行的圖像設置動畫。在點擊主視圖上的「幫助」按鈕時,幫助圖像將從左向右迴歸動畫。我使用下面的代碼動畫:我現在面臨使用約束動畫全屏UIImageView

self.helpViewLeadingConstraint.constant = 600; 
[self.view layoutIfNeeded]; 


問題是,當動畫過程中,我看到了一些警告。

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:0x7fdda85a4b70 UIView:0x7fddaa8f05a0.trailingMargin == UIView:0x7fdda85a3460.trailing - 16>", 
    "<NSLayoutConstraint:0x7fdda85a4c10 UIView:0x7fdda85a3460.leading == UIView:0x7fddaa8f05a0.leadingMargin + 600>", 
    "<NSLayoutConstraint:0x7fddabb09e30 'UIView-Encapsulated-Layout-Width' H:[UIView:0x7fddaa8f05a0(375)]>" 
) 

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7fdda85a4b70 UIView:0x7fddaa8f05a0.trailingMargin == UIView:0x7fdda85a3460.trailing - 16> 

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. 


我無法找到一個解決方案,以避免該警告消息。我們如何設定滿足兩個約束而不產生任何不成功的消息?

+0

你是用xib還是以編程方式添加全屏圖像? –

+0

@ZaidPathan,我在「Storyboard」中添加了全屏圖像 – Satyam

+0

我認爲你也錯誤地給了寬度約束,所以前導約束可能不滿意。 –

回答