ios - Updating constraints in animation with Swift -
i want animation move uiimageview new position defined new set of constraints, reason cannot work. i'm trying do:
@iboutlet weak var oldbottom: nslayoutconstraint! ... func animatemovement() { // here i'm defining new constraint var newbottom = nslayoutconstraint( item: self.logo, attribute: nslayoutattribute.bottom, relatedby: nslayoutrelation.equal, toitem: self.usernamefield, attribute: nslayoutattribute.bottom, multiplier: 1, constant: 15) self.view.layoutifneeded() uiview.animatewithduration(1.0, animations: { // here i'm setting existing constraint (defined in storyboard) new constraint self.oldbottom = newbottom self.view.layoutifneeded() }, completion: {}) }
any thoughts appreciated!
remove self.view.layoutifneeded()
outside block. have 1 inside animation block , should sufficient.
Comments
Post a Comment