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

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