I have a ViewController with a bunch of UIImageViews that I need to send to the front and animate to the center of the view.
I have tried to call bringSubviewToFront before casting the UIView animation and what seems to be happening is that the view is sent to the top of the stack, but the animation does not happen (even though the completion handler log shows as if the animation DID happen).
The second time i press the button that triggers the animation (considering that this time the view is already at top index, the animation takes place as it should)
Heres my code:
- (void)beginAnimationWithSelectedCountry:(UIView *)countryView
{
if (!countryView) return;
[self.view bringSubviewToFront:countryView];
[UIView animateWithDuration:0.6f delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
countryView.center = CGPointMake(self.view.center.x, self.view.center.y);
} completion:^(BOOL finished) {
NSLog(@"Animation complete");
}];
}
Any thoughts? I've been at this for hours >.<
Thanks
EDIT: If I comment out the bringSubviewToFront the code executes flawlessly with the animation (except the view is under some other views) so i'm preety sure the problem is with the line:
[self.view bringSubviewToFront:countryView];
Heres a screenshot of what I have currently that may shed some more light on the issue: http://d.pr/i/PKoa