2012-03-02 65 views
0

我需要帮助在这里,我使用自定义segue推视图控制器到另一个视图控制器。UIActivityIndi​​catorView冻结时使用自定义segue

当使用cutom segue进行推送时,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]; 

} 

回答

1

试试这个:

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

-pushViewController:animated:不应该在动画块,但完成块推杆。

+0

您好,谢谢您的回复...它的作品,但我失去了动画。任何解决方法? – Desmond 2012-03-02 03:48:55

+0

为选项参数设置过渡选项,如'UIViewAnimationOptionTransitionCrossDissolve',然后它应该工作。 – cxa 2012-03-02 03:59:56

+0

喜xan,试过了。不工作:( – Desmond 2012-03-02 04:07:42

相关问题