【发布时间】:2017-03-22 17:42:06
【问题描述】:
我在 Swift 中有一个 UIView
let postDiv: UIView = {
let div = UIView()
return div
}()
profile_view.addSubview(postDiv)
profile_view.addSubview(PostDiv)
profile_view.addSubview(PostDiv)
当我只添加其中一个作为子视图时,它可以工作,但是当我添加几个时,它们会相互重叠,所以只有它们是可见的,我怎样才能相互添加锚点。这是我当前的锚点
postDiv.anchor(postsDiv.bottomAnchor, left:view.leftAnchor, bottom: nil, right: view.rightAnchor, topConstant: 40, leftConstant: 15, bottomConstant: 0, rightConstant: 15, widthConstant: 0, heightConstant: 165)
【问题讨论】:
-
请:将变量小写以区别于类!
-
谢谢。 div也:)
-
@muescha 我将变量小写,因此您可以将它们与类区分开来
-
请同时发布您的代码
i add several -
也许
UIStackView是您要找的?