mirror of https://github.com/SnapKit/SnapKit
Allow size attributes to be installed on a view itself
This commit is contained in:
parent
21a73287f3
commit
c75495cf4c
|
@ -297,10 +297,16 @@ public class Constraint {
|
||||||
} else {
|
} else {
|
||||||
installOnView = self.fromItem.view?.superview
|
installOnView = self.fromItem.view?.superview
|
||||||
if installOnView == nil {
|
if installOnView == nil {
|
||||||
|
if self.fromItem.attributes == ConstraintAttributes.Width || self.fromItem.attributes == ConstraintAttributes.Height {
|
||||||
|
installOnView = self.fromItem.view
|
||||||
|
}
|
||||||
|
|
||||||
|
if installedOnView == nil {
|
||||||
NSException(name: "Cannot Install Constraint", reason: "Missing superview", userInfo: nil).raise()
|
NSException(name: "Cannot Install Constraint", reason: "Missing superview", userInfo: nil).raise()
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var layoutConstraints: Array<LayoutConstraint> = []
|
var layoutConstraints: Array<LayoutConstraint> = []
|
||||||
let layoutFromAttributes = self.fromItem.attributes.layoutAttributes
|
let layoutFromAttributes = self.fromItem.attributes.layoutAttributes
|
||||||
|
|
Loading…
Reference in New Issue