change the result constraint of maker.center.equalTo(CGPoint) to based on the original point of superview (#336)

* change center.equalTo

* fix logic
This commit is contained in:
Living 2016-09-28 19:41:15 +08:00 committed by Robert Payne
parent 3f529652a4
commit da4426cb9a
1 changed files with 5 additions and 1 deletions

View File

@ -114,9 +114,13 @@ public class Constraint {
} else { } else {
layoutToAttribute = layoutToAttributes[0] layoutToAttribute = layoutToAttributes[0]
} }
} else {
if self.to.target == nil && (layoutFromAttribute == .centerX || layoutFromAttribute == .centerY) {
layoutToAttribute = layoutFromAttribute == .centerX ? .left : .top
} else { } else {
layoutToAttribute = layoutFromAttribute layoutToAttribute = layoutFromAttribute
} }
}
#else #else
if self.from.attributes == self.to.attributes { if self.from.attributes == self.to.attributes {
layoutToAttribute = layoutFromAttribute layoutToAttribute = layoutFromAttribute