【发布时间】:2020-08-04 15:29:38
【问题描述】:
enter image description here我是 Swift 开发的新手,距离我尝试解决我面临的这个问题已经过去了几个小时。错误在于约束。下面是我的代码:
// 我的约束代码
skipButtonAnchor = skipButton.anchor(view.safeAreaLayoutGuide.topAnchor, left: view.leadingAnchor, bottom: nil, right: view.trailingAnchor, topConstant: 0, leftConstant: 0, bottomConstant: 0, rightConstant: 0, widthConstant: 0, heightConstant: 50)
bottomStackAnchor = bottomStack.anchor(nil, left: view.leadingAnchor, bottom: view.safeAreaLayoutGuide.bottomAnchor, right: view.trailingAnchor, topConstant: 0, leftConstant: 125, bottomConstant: 0, rightConstant: 0, widthConstant: 0, heightConstant: 50)
// 我已经为 .anchor 创建了这样的函数:
func anchor(_ top: NSLayoutYAxisAnchor? = nil, left: NSLayoutXAxisAnchor? = nil, bottom: NSLayoutYAxisAnchor? = nil, right: NSLayoutXAxisAnchor? = nil, topConstant: CGFloat = 0, leftConstant: CGFloat = 0, bottomConstant: CGFloat = 0, rightConstant: CGFloat = 0, widthConstant: CGFloat = 0, heightConstant: CGFloat = 0) -> [NSLayoutConstraint] {
translatesAutoresizingMaskIntoConstraints = false
}
我期待着寻求帮助。提前致谢
【问题讨论】:
-
“我面临的问题”是什么?
标签: swift uiview uibutton nslayoutconstraint terminate