'UIActivityIndicatorView freezes when moving from one UIViewController to another UIViewController in storyboard by using custom AnimationTransition?
There is a UIActivityIndicatorView in the secondView controller and it is not spinning when I am moving from firstView controller to secondView controller. The code behind moving from firstView controller to secondView controller is given below:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:2.0f];
[UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
secondView *secondObj = [self.storyboard instantiateViewControllerWithIdentifier:@"secondCtrolr"];
[self.navigationController secondObj animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
[UIView commitAnimations];
Then in secondView controller it only shows the spinner which is not spinning. The I remove the custom animation code like that following
secondView *secondObj = [self.storyboard instantiateViewControllerWithIdentifier:@"secondCtrolr"];
[self.navigationController secondObj animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
Then I show that spinner is spinning in secondView controller but there is no transition animation. And also if I write the animation transition code like:
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:NO];
Then spinner is spinning but no transition animation happens.
The code which I write for spinner is give below:
UIActivityIndicatorView *rotator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
[rotator setBackgroundColor:[UIColor blackColor]];
[rotator setAlpha:0.7f];
rotator.hidesWhenStopped = YES;
rotator.frame = self.view.bounds;
[self.view addSubview:rotator]; // spinner is not visible until started
[rotator startAnimating];
What's the problem behind this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
