ios - 加载 View Controller 时的自动布局警告

标签 ios ios8 autolayout xcode6

我已尽力阅读其他一些帖子,但仍然难以理解为什么这会对我的自动布局发出警告,并希望有人可以提供建议。我在 xcode6 中。

问题 # 1 - 自动布局约束出现这些警告/崩溃通常可以吗?或者这是一件非常严重的事情,我应该尽我最大的努力去解决?

问题#2 - 这是输出。我觉得这与我在 View Controller 中设置项目的宽高比有关(我有 3 个矩形 View ,我希望它们分别是高度的 15%、60%、25% 和完全相等的宽度)。我认为告诉它保持纵横比是处理这个问题的正确方法?

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:0x7f8a66031bc0 V:[UITableView:0x7f8a65837c00(73)]>",
    "<NSLayoutConstraint:0x7f8a6605c150 UITableView:0x7f8a65837c00.width == 7.78082*UITableView:0x7f8a65837c00.height>",
    "<NSLayoutConstraint:0x7f8a6604e970 UICollectionView:0x7f8a65838400.leading == UIView:0x7f8a66031eb0.leadingMargin>",
    "<NSLayoutConstraint:0x7f8a6604e9c0 UICollectionView:0x7f8a65838400.trailing == UIView:0x7f8a66031eb0.trailingMargin>",
    "<NSLayoutConstraint:0x7f8a6604ea10 UICollectionView:0x7f8a65838400.width == UITableView:0x7f8a65837c00.width>",
    "<NSLayoutConstraint:0x7f8a63c4ccf0 'UIView-Encapsulated-Layout-Width' H:[UIView:0x7f8a66031eb0(320)]>"
)

非常感谢您的帮助!

最佳答案

[[NSUserDefaults standardUserDefaults] setValue:@(NO) forKey:@"_UIConstraintBasedLayoutLogUnsatisfiable"];

此控制台警告不会造成任何问题。 在 appdelegate 中添加此代码。这将从控制台隐藏约束错误消息

关于ios - 加载 View Controller 时的自动布局警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27173302/

相关文章:

ios - Swift:什么时候执行 Dismiss View 的完成 block ?

ios - 如何为 UIButtonTypeCustom 实现 tintcolor 行为

crash - IOS 8 在方向更改时崩溃

ios - 如何使用带有 Pinterest.sharextension 的 UIActivityViewController 设置 Pinterest sourceURL 和描述

ios - 使用自动布局的 UITableViewCell 中的单个 UIImageView

ios - 解码奇怪的 AutoLayout 错误消息

ios - 为Xcode 11中的旧源代码启用自动布局

iOS 在界面生成器中设置自定义字体在设备上不起作用

调用 stopDeviceMotionUpdates() 后抛出 iOS CoreMotion.MotionThread EXC_BAD_ACCESS

ios8 - AVCaptureSession 在 ios8 的主线程上阻塞 UI