I'm trying to push my iOS development learning a little bit further by taking a look into auto layout and linear equation y = mx + b
.
(我试图通过研究自动布局和线性方程y = mx + b
进一步推动我的iOS开发学习。)
Here is a simple exercise that I'm using : I have the SafeArea View
and I added a greeView
just above it.
(这是我正在使用的一个简单练习:我有SafeArea View
并在其上方添加了greeView
。)
and I marked the four constraints that I'm interested in (#1 for the the top constraint, #2 for the Trailing one, #3 for the bottom one and #4 for the Leading constraint) (并标记了我感兴趣的四个约束(#1代表顶部约束,#2代表尾随约束,#3代表底部约束,#4代表Leading约束))
So, by applying the linear equation for the first one for example, it would be :
(因此,例如,通过对第一个方程应用线性方程,将是:)
(1) : greenView.Top = 1.safeArea.top + 20
((1):greenView.Top = 1.safeArea.top + 20)
but apparently for the second constraint it's not :
(但显然对于第二个约束不是:)
(2) : greenView.Trailing = 1.safeArea.Trailing + 20
((2):greenView.Trailing = 1.safeArea.Trailing + 20)
but instead, it should be :
(但是,应该是:)
(2) : safeArea.Trailing = 1.greenArea.Trailing + 20
((2):safeArea.Trailing = 1.greenArea.Trailing + 20)
I think I'm missing something to understand the logic behind the alignment of the 2nd constraint.
(我想我缺少一些了解第二约束对齐方式背后的逻辑的东西。)
Any hints please ? (有什么提示吗?)
Thank you (谢谢)
ask by Hajar ELKOUMIKHI translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…