我尝试使用autolayout将图像视图放在笔尖内:
以下是图片视图的约束:
但是,在运行时,由于与父视图(TUFailedSharingView
)的中心Y约束发生冲突,我的高度约束正在中断。问题是:我没有在任何地方创建任何中心Y约束!
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.
(
"<NSLayoutConstraint:0x17009b530 UIImageView:0x10193a180.height == 31>",
"<NSLayoutConstraint:0x170280460 TUFailedSharingView:0x10190d940.height == 65>",
"<NSLayoutConstraint:0x170280640 UIImageView:0x10193a180.top == TUFailedSharingView:0x10190d940.top + 16.5>",
"<NSLayoutConstraint:0x170281680 UIImageView:0x10193a180.centerY == TUFailedSharingView:0x10190d940.centerY>"
)
图像视图高度约束是可以的(由于1:1的宽高比),父高度约束也没关系(我已经设置好了),顶部约束也没关系,但是中心Y在哪里约束甚至来自?我没有在任何地方添加它(在代码或IB中都没有)。 iOS如何创建一个幻象&#34;中心Y约束?