constraints

Change UIView constraints in chained animations

早过忘川 提交于 2020-08-05 22:54:51
问题 I'm trying to create a chained animation of a UIButton with a delay between the two animations: let firstAnimation: TimeInterval = 0.3 let secondAnimation: TimeInterval = 0.35 let delay: TimeInterval = 2.0 let animationDuration: TimeInterval = firstAnimation + secondAnimation + delay UIView.animateKeyframes(withDuration: animationDuration, delay: 0, options: [], animations: { UIView.addKeyframe(withRelativeStartTime: 0, relativeDuration: firstAnimation / animationDuration, animations: { self

Programmatically Change multiplier of Alignment Constraint of Center X / Y

北战南征 提交于 2020-07-18 12:34:54
问题 How can I programmatically change the multiplier in the simplest way? For Swift 2.0 回答1: So for Y, if you set the top of the image equal with a constant of 0 to the top of the superView. then enter this code: @IBOutlet weak var topc: NSLayoutConstraint! let heightOfSuperview = self.view.bounds.height topc.constant = heightOfSuperview * 0.90 // this has the same effect as multiplier This is equivalent of Center.y multiplier = 0.9:1 回答2: I try to use extension but it not work, but change to the