简体   繁体   English

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

[英]iOS - Trying to implement animating clock: Unable to simultaneously satisfy constraints runtime error -noob level 99

I admit I'm in over my head here, but I think I'm missing something simple. 我承认我在这里烦恼,但我认为我缺少一些简单的东西。

I found this sweet clock on github but it's not packaged to be includable, and I don't understand the runtime error about constraints enough to properly implement this code. 我在github上发现了这个甜蜜的时钟,但是它并不打包成不可理解的,而且我不了解有关约束的运行时错误,不足以正确实现此代码。 I love this clock though, so if anybody can help I would love to include it in my app! 不过,我喜欢这个时钟,因此,如果有人可以帮忙,我希望将其添加到我的应用中!

The clock: https://github.com/DuncanMC/ClockAnimation 时钟: https//github.com/DuncanMC/ClockAnimation

What I did: 我做了什么:

-started a new single view Xcode project -copied (drag and dropped) the clock hands images out of Images.xcassets into this Images.xcassets in my project -copied the relevant classes and view controller code -开始一个新的单一视图Xcode项目-将钟针图像从Images.xcassets复制(拖放)到我的项目中的Images.xcassets中-复制相关类和视图控制器代码

I get this error at runtime: 我在运行时收到此错误:

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.

Turn off auto layout in the view's file inspector ! 在视图的文件检查器中关闭自动布局! It should work. 它应该工作。 image 图片

If the storyboard / nib itself is giving you any layout warnings / errors whatever, fix them! 如果情节提要/笔尖本身给您任何布局警告/错误,请修复它们! Do not attempt to run until all warnings / errors are gone. 在所有警告/错误都消失之前,请勿尝试运行。

Otherwise, either turn off auto layout or give your views meaningful constraints - and again, you will then need to keep applying constraints until all warnings/errors are gone. 否则,请关闭自动布局或为视图赋予有意义的约束-然后,您将需要继续应用约束,直到所有警告/错误消失。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM