且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Xcode 10/iOS 12中未遵守锚定约束

更新时间:2023-02-04 12:37:24

我发布了第二次更新的答案,但为了清楚起见:

I posted what seems to be the answer in my second update, but for clarity:

我在应用锚点约束后添加了self.layoutIfNeeded(),这似乎已经解决了问题.尽管查看自我的框架并得到-199,-100,398,200不能说我理解X and Y的值.尽管如此,尽管为什么在Xcode 10/iOS 12中要求这么做,layoutIfNeeded似乎已经解决了这个问题.

I added a self.layoutIfNeeded() just after applying the anchor constraints and that seems to have solved the issue. Although looking at the frame for self and I get -199,-100,398,200 Cannot say I understand the values for X and Y. Nevertheless the layOutIfNeeded seems to have solved the problem although why this is required in Xcode 10/ iOS 12 is also a mystery.