문제

여기에 도움이 필요합니다. 다른보기 컨트롤러로보기 컨트롤러를 푸시하려면 사용자 정의 세그리를 사용하고 있습니다.

컷오먼 세그 척을 사용하여 푸시하면 UIActivityIndicator가로드 될 때 자동으로 애니메이션을 움직이지 않습니다.

그러나 스토리 보드에서 푸시 메소드를 사용하면 UIActivityIndicator가 자동으로 애니메이션을합니다.

내가 무엇을 잘못 했는가?

-(void)perform {
    UIViewController *sourceVC = (UIViewController *) self.sourceViewController;
    UIViewController *destinationVC = (UIViewController *) self.destinationViewController;

    [UIView transitionWithView:sourceVC.navigationController.view duration:0.5
                       options:UIViewAnimationOptionTransitionCrossDissolve
                    animations:^{
                        [sourceVC.navigationController pushViewController:destinationVC animated:NO];
                        //NSLog(@"count of subview %i", [self.view.subviews count]);
                    }
                    completion:NULL];

}
.

도움이 되었습니까?

해결책

Try this:

UIViewController *sourceVC = (UIViewController *) self.sourceViewController;
UIViewController *destinationVC = (UIViewController *) self.destinationViewController;

[UIView transitionFromView:sourceVC.view toView:destinationVC.view duration:.5 options:0 completion:^(BOOL finished) {
  [sourceVC.navigationController pushViewController:destinationVC animated:NO];
}];

The -pushViewController:animated: should not be putted in the animation block but the completion block.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top