加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ios – Xcode中的灰色变暗

发布时间:2020-12-14 17:43:21 所属栏目:百科 来源:网络整理
导读:我正在尝试调试了解自动布局约束,我注意到在使用 xcode调试视图时(使用酷层事物)我注意到在视图中的一个元素上,约束看起来像这样 而观点确实忽略了这些限制. 所有约束具有相同的优先级(1000),因为我想要它们.所有约束都是使用接口构建器而不是通过代码进行的
我正在尝试调试了解自动布局约束,我注意到在使用 xcode调试视图时(使用酷层事物)我注意到在视图中的一个元素上,约束看起来像这样

而观点确实忽略了这些限制.

所有约束具有相同的优先级(1000),因为我想要它们.所有约束都是使用接口构建器而不是通过代码进行的,并且IB中没有警告或冲突.

但在运行时我确实看到了这一点

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:0x79684f10 V:[UIImageView:0x79686800(>=160)]>","<NSLayoutConstraint:0x7968a310 V:[UIImageView:0x79686800]-(130.5)-|   (Names: '|':UIView:0x79686790 )>","<NSLayoutConstraint:0x7968a340 V:|-(0)-[UIImageView:0x79686800]   (Names: '|':UIView:0x79686790 )>","<NSLayoutConstraint:0x796997b0 'UIView-Encapsulated-Layout-Height' V:[CoverCell:0x79686570(192)]>","<NSAutoresizingMaskLayoutConstraint:0x7969cd30 h=-&- v=-&- UIView:0x79686790.height == CoverCell:0x79686570.height>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x79684f10 V:[UIImageView:0x79686800(>=160)]>

所以我从中了解到一些规则存在冲突,但我不确定如何阅读

> = 160是UIImageView上的规则,所以它的高度至少为160,而130.5是imageview的底部填充(所以当使用systemLayoutSizeFittingSize:UILayoutFittingCompressedSize时,高度不会是0.所以整个最小高度细胞是160 130.5)

剩下的错误我不明白.

约束有什么问题,为什么约束冲突发生在运行时而不是IB?

解决方法

XCode 6现在支持不同的布局.紧凑宽度|中存在这种灰色约束例如,任何高度布局,但您当前正在编辑任何宽度|任何高度.

更详细:
Storyboard View Elements Greyed Out

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读