First set your constraint to your view and than layoutIfNeeded in animation.

// let say there is one object of UIView in storyboard/xib and you have set auto layout to that particular view. Now, if suppose you have to set bottam constraint accourding to your requirenment than follow below code

@property (strong, nonatomic) IBOutlet NSLayoutConstraint *bottamViewConstraint;
@property (strong, nonatomic) IBOutlet UIView *customView;
// In code when you have to change this above constraint follow below code:

self.bottamViewConstraint.constant = 50;
[UIView animateWithDuration:0.5 animations:^{

[self.view layoutIfNeeded];// If you have to animate complete view
[customView layoutIfNeeded];// If you have to animate any particular view

}];

You may also like

Leave a Reply