2016-07-05 42 views
1

我一直试图将以下UIView居中放置在手机绝对中心以上70像素处。我想使用PureLayout,以便在iPad上使用拆分屏幕或旋转屏幕时约束条件会发生变化。这是我当前的代码:带偏移量的PureLayout中心

self.checkBall.frame.origin.x = self.view.bounds.width/2 - self.checkBall.frame.width/2 + 70 
self.checkBall.frame.origin.y = self.view.bounds.height/2 - self.checkBall.frame.height/2 - 70 
+0

请注意您的当前代码:您的描述听起来像只是想将视图向上移动,但代码正在向上和向右移动。 –

回答

0

您正在使用PureLayout?

self.checkBall.autoAlignAxis(.vertical, toSameAxisOf: self.view) 
self.checkBall.autoAlignAxis(.horizontal, toSameAxisOf: self.view, withOffset: -70.0)