iOS -尝试实现动画时钟:无法同时满足约束运行时错误-新手级别99



我承认这是我的头,但我想我错过了一些简单的东西。

我在github上发现了这个甜蜜的时钟,但它没有被打包为可包含的,我不理解关于约束的运行时错误,不足以正确实现此代码。我喜欢这个时钟,所以如果有人能帮助我,我很乐意把它包括在我的应用程序!

钟:https://github.com/DuncanMC/ClockAnimation

我做了什么:

-启动一个新的单视图Xcode项目-复制(拖放)时钟指针图像的图像。xcassets到这个图像。Xcassets在我的项目中-复制相关的类和视图控制器代码

我在运行时得到这个错误:

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) 
(
    "<NSIBPrototypingLayoutConstraint:0x8c31fb0 'IB auto generated at build time for view with fixed frame' H:[UIImageView:0x8c2bde0(22)]>",
    "<NSIBPrototypingLayoutConstraint:0x8c31fe0 'IB auto generated at build time for view with fixed frame' V:[UIImageView:0x8c2bde0(250)]>"
)
Will attempt to recover by breaking constraint 
<NSIBPrototypingLayoutConstraint:0x8c31fe0 'IB auto generated at build time for view with fixed frame' V:[UIImageView:0x8c2bde0(250)]>
Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2014-06-11 14:34:36.537 Project Manager[1739:70b] 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) 
(
    "<NSIBPrototypingLayoutConstraint:0x8c32070 'IB auto generated at build time for view with fixed frame' H:[UIImageView:0x8c2fa00(22)]>",
    "<NSIBPrototypingLayoutConstraint:0x8c320a0 'IB auto generated at build time for view with fixed frame' V:[UIImageView:0x8c2fa00(250)]>"
)
Will attempt to recover by breaking constraint 
<NSIBPrototypingLayoutConstraint:0x8c320a0 'IB auto generated at build time for view with fixed frame' V:[UIImageView:0x8c2fa00(250)]>
Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2014-06-11 14:34:36.555 Project Manager[1739:70b] 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) 
(
    "<NSIBPrototypingLayoutConstraint:0x8c32200 'IB auto generated at build time for view with fixed frame' H:[UIImageView:0x8c0d210(22)]>",
    "<NSIBPrototypingLayoutConstraint:0x8c32230 'IB auto generated at build time for view with fixed frame' V:[UIImageView:0x8c0d210(250)]>"
)
Will attempt to recover by breaking constraint 
<NSIBPrototypingLayoutConstraint:0x8c32230 'IB auto generated at build time for view with fixed frame' V:[UIImageView:0x8c0d210(250)]>
Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.

关闭视图文件检查器中的自动布局!这应该行得通。图片

如果storyboard/nib本身给你任何布局警告/错误,修复它们!在所有警告/错误都消失之前,不要尝试运行。

否则,要么关闭自动布局,要么给你的视图提供有意义的约束——同样,你需要继续应用约束,直到所有的警告/错误都消失。

最新更新