Allow size attributes to be installed on a view itself

This commit is contained in:
Robert Payne 2015-01-27 00:31:17 +13:00
parent 21a73287f3
commit c75495cf4c
1 changed files with 6 additions and 0 deletions

View File

@ -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