i am animating an UIImageView with an image of a circle that grows and fades which repeats:
-(void)animateOuterCircle
{
NSLog(@"animating circles");
[UIView animateWithDuration:1.5
delay:.5
options:(UIViewAnimationOptionAllowUserInteraction)
animations:^{
self.outerCircle.transform=CGAffineTransformMakeScale(.25, .25);
}
completion:nil];
[UIView animateWithDuration:1.5
delay:.5
options:(UIViewAnimationOptionRepeat | UIViewAnimationOptionAllowUserInteraction)
animations:^{
self.outerCircle.transform=CGAffineTransformMakeScale(1.5, 1.5);
self.outerCircle.alpha = 0;
}
completion:nil];
[self.view bringSubviewToFront:self.outerCircle];
}
i call this method in viewDidAppear:
- (void)viewDidAppear:(BOOL)animated
{
[self performSelectorOnMainThread:@selector(animateOuterCircle) withObject:nil waitUntilDone:NO];
//other code
}
It will animate fine when i load mainView. the issue is i load view2 and dismiss view2, when i come back to mainView, it is not animating anymore.
any ideas why this is happening?
EDIT: the methods are being called:
2012-03-15 14:11:13.946[1529:17903] view2 canceled //dismissing view2
2012-03-15 14:11:13.947[1529:17903] mapView viewWillAppear fired
2012-03-15 14:11:13.948[1529:17903] mapView viewWillAppear end
2012-03-15 14:11:14.352[1529:17903] mapView viewDidAppear fired
2012-03-15 14:11:14.353[1529:17903] animating circles
2012-03-15 14:11:14.354[1529:17903] mapView viewDidAppear end
EDIT 2:
-(IBAction) fourthBtn:(id)sender
{
view2 *view2 = [self.storyboard instantiateViewControllerWithIdentifier:@"view2"];
[self presentModalViewController:view2 animated:YES];
}
dismissing view 2:
-(IBAction) cancel:(id) sender
{
NSLog(@"heir canceled");
[self dismissModalViewControllerAnimated:YES];
}
also, i don't stop the animation myself at any point in my code.