In layoutSubviews i layout my child views into appropriate positions, and for some of them apply some transformation. Now i want to make on this subviews repeatable scale animation to draw attention. But, when i launch animation with [UIView animate....], with changing transform property - fired layoutSubviews method, which conflict with animation (it override transform and animation not played).
Is there any good way (without bool flags) to handle this behavior?
Example:
- (void)layoutSubviews {
[super layoutSubviews];
myChildView.transform = CGAffineTransformMake....;
}
- (void)animate {
CGAffineTransform originalTransform = myChildView.transform;
[UIView animateWithDuration:0.1f
delay:0.0f
options:UIViewAnimationOptionAutoreverse
animations:^{
[UIView setAnimationRepeatCount:4];
//next line of code produce calling layoutSubviews
myChildView.transform = CGAffineTransformMakeScale(1.15f, 1.15f);
} completion:^(BOOL finished){
myChildView.transform = originalTransform;
//after this also called layoutSubviews
}];
}