2012-03-02 19 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

相關問題