I have a UIScrollView placed inside of a ViewController to which I have given AutoLayout Constraints and all of them are satisfied. The scrollView contains around 20 UIButton subviews. I have given autolayout constraints to them also and they all are also satisfied.
What I need to do is I want to animate those buttons when the view is first launched. This is my code for animation
for (UIButton *button in [scrollView subviews]) {
CGRect mainFrame = [button frame];
[UIView animateWithDuration:0.0 animations:^{
button.frame = CGRectMake(button.center.x, button.center.y, 0, 0);
} completion:^(BOOL finished) {
[UIView animateWithDuration:1 delay:0.5 usingSpringWithDamping:0.3 initialSpringVelocity:0.2 options:UIViewAnimationOptionCurveEaseOut animations:^{
button.frame = mainFrame;
} completion:^(BOOL finished) {
}];
}];
}
The subviews are not animating when I use this code. But when I set the
[button setTranslatesAutoresizingMaskIntoConstraints:YES];
it works. But this time I get the error Unable to Simultaneously Satisfy constraints.
Is there any other method to do it or should I just ignore the error message and just go with it?