-(void)modifyConstraint:(UIButton *)btn{ btn.translatesAutoresizingMaskIntoConstraints = NO; NSArray* constrains = btn.constraints; NSLayoutConstraint *widthConstraint = [NSLayoutConstraint constraintWithItem:btn attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:0]; for (NSLayoutConstraint* constraint in constrains) { if (constraint.firstAttribute == NSLayoutAttributeWidth) { [UIView animateWithDuration:1 animations:^{ [btn addConstraint:widthConstraint]; [btn removeConstraint:constraint]; [btn layoutIfNeeded]; } completion:^(BOOL finished) { dispatch_time_t timer = dispatch_time(DISPATCH_TIME_NOW, 0.5 * NSEC_PER_SEC); dispatch_after(timer, dispatch_get_main_queue(), ^{ [UIView animateWithDuration:.3 animations:^{ [btn removeConstraint:widthConstraint]; [btn addConstraint:[NSLayoutConstraint constraintWithItem:btn attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:40]]; [btn layoutIfNeeded]; } completion:^(BOOL finished) { }]; }); }]; break; } } }