2015-06-21 38 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

我认为你也错误地给了宽度约束,所以前导约束可能不满意。 –

回答