动画约束会改变边距

时间:2016-07-15 06:22:47

标签: swift2 constraints uiviewanimation

在我的应用程序中,我想显示一个来自底部的视图。因此,我已经制定了底部约束的动画。动画会罚款,但问题是边距不合适

原始视图

enter image description here

enter image description here

问题是按钮不在中心

代码

let translate = CGAffineTransformMakeTranslation(0, -(view.frame.height/2 - view.center.y/4 + 20))
        let scale =  CGAffineTransformMakeScale(0.7, 0.7);
        let transform = CGAffineTransformConcat(translate, scale)


        UIView.animateWithDuration(0.6, delay: 0, options: .CurveEaseInOut, animations: {
            self.ivLogo.transform = transform
            }, completion:nil)



        self.view.layoutIfNeeded()
        //self.loginSignUpView.layoutIfNeeded()
        UIView.animateWithDuration(1.0, delay: 0, options: .CurveEaseInOut, animations: {

            self.loginSignUpBottomConst.constant=30
            self.loginSignUpView.layoutIfNeeded()
            self.view.layoutMarginsDidChange()
            }, completion: nil)


    }

0 个答案:

没有答案