gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 02:28:45 33 4
gpt4 key购买 nike

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

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com