在 UIView
文档中声明,如果需要约束,您必须覆盖 requiresConstraintBasedLayout
以在您的自定义 View 中返回 true
工作。
如何使用 Swift 3 做到这一点?
最佳答案
使用以下语法覆盖 getter:
override open class var requiresConstraintBasedLayout: Bool {
get {
return true
}
}
关于ios - 如何使用 Swift 3 覆盖 UIView 中的 requiresConstraintBasedLayout?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42530067/