Browse Source

Allow size attributes to be installed on a view itself

Robert Payne 11 years ago
parent
commit
c75495cf4c
1 changed files with 6 additions and 0 deletions
  1. 6 0
      Snap/Constraint.swift

+ 6 - 0
Snap/Constraint.swift

@@ -297,8 +297,14 @@ public class Constraint {
         } else {
             installOnView = self.fromItem.view?.superview
             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()
                 return []
+              }
             }
         }