【问题标题】:Autolayout put UIView in the middle between the margin and another UIViewAutolayout 将 UIView 放在边距和另一个 UIView 之间
【发布时间】:2014-11-05 23:35:38
【问题描述】:
我想知道如何在界面生成器中使用自动布局将 UIView 放在屏幕边缘和另一个 UIView 之间,这是架构:
margin| --UIViewTocenter-- |UIView
margin是superview的左边距,然后右边是UIView,我想把UIViewToCenter放在两个元素的中间,我怎么在界面生成器中做到这一点?
谢谢
【问题讨论】:
标签:
ios
objective-c
autolayout
【解决方案1】:
最简单的方法是放置一个额外的容器视图。所以你会有类似的东西:
|-margin-[ContinerView]-|[UIView]|
然后在 ContainerView 中放置你的 UIViewToCenter 并在它的 superview 中居中。
|-UIViewToCenter-|