gpt4 book ai didi

Swift Autolayout 警告和其他我不明白的警告

转载 作者:行者123 更新时间:2023-11-30 10:14:02 29 4
gpt4 key购买 nike

该应用程序允许用户发布图像/关注其他人等。

所以它工作正常,但我收到以下警告:(我知道有些与自动布局约束有关,但我如何知道哪个导致了问题?)

2015-07-05 17:19:37.701 Pixym[1271:72192] CUICatalog: Invalid asset name supplied: 

2015-07-05 17:19:37.702 Pixym[1271:72192] Could not load the "" image referenced from a nib in the bundle with identifier "HP.Pixym"

2015-07-05 17:19:37.705 Pixym[1271:72192] 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:0x7fa83b822a40 H:[UIImageView:0x7fa83b8529a0(300)],
NSLayoutConstraint:0x7fa83b85ccb0 H:[UIImageView:0x7fa83b8529a0]-(10)-| (Names: '|':UITableViewCellContentView:0x7fa83b871ff0 ),
NSLayoutConstraint:0x7fa83b8643d0 H:|-(10)-[UIImageView:0x7fa83b8529a0] (Names: '|':UITableViewCellContentView:0x7fa83b871ff0 ),
NSLayoutConstraint:0x7fa83b80ab00 'UIView-Encapsulated-Layout-Width' H:[UITableViewCellContentView:0x7fa83b871ff0(375)])

Will attempt to recover by breaking constraint
NSLayoutConstraint:0x7fa83b822a40 H:[UIImageView:0x7fa83b8529a0(300)]

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.

任何帮助将不胜感激。

最佳答案

从约束来看,您似乎有一个宽度为 300 且左右填充为 10 的 imageView。这在 iPhone 5 上可以正常工作(屏幕宽度为 320),但是在 iPhone 6/6 Plus 上会崩溃,因为宽度较大。

您需要做的是弄清楚您希望图像在所有屏幕上看起来如何。 10 像素填充比宽度更重要还是您希望它的宽度始终为 300?

如果您想要宽度,请删除其他 2 个约束并为图像添加一个容器中水平中心约束。

在另一种情况下,只需删除宽度限制,一切就应该可以工作。

祝你好运!

关于Swift Autolayout 警告和其他我不明白的警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31231946/

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