3

控制器中有一个UIActivityIndicatorViewsecondView当我从firstView一个控制器移动到另一个控制器时它没有旋转secondViewfirstView从控制器移动到控制器背后的代码secondView如下:

[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];

然后在 secondView 控制器中它只显示不旋转的微调器。我删除了自定义动画代码,如下所示

secondView *secondObj = [self.storyboard instantiateViewControllerWithIdentifier:@"secondCtrolr"];
[self.navigationController secondObj animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];

然后我显示微调器正在secondView控制器中旋转,但没有过渡动画。而且,如果我编写动画转换代码,例如:

[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:NO]; 

然后微调器正在旋转,但没有过渡动画发生。

我为微调器编写的代码如下:

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];

这背后的问题是什么?

4

0 回答 0