2012-05-24 29 views
1

任何人都可以告訴下面的代碼段的等效塊動畫嗎?這比一些我看到的堆棧的其他方式動畫UINavigationController轉換塊

[UIView beginAnimations:@"View Flip" context:nil]; 
[UIView setAnimationDuration:0.75]; 
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight 
      forView:self.navigationController.view cache:NO]; 

NextViewController *next = [[NextViewController alloc] 
      initWithNibName:@"NextViewController" bundle:nil]; 

[self.navigationController pushViewController:next animated:YES]; 
[next release]; 
[UIView commitAnimations]; 

回答

12
NextViewController *next = [[NextViewController alloc] initWithNibName:@"NextViewController" bundle:nil]; 

[UIView transitionWithView:self.navigationController.view 
        duration:0.75 
        options:UIViewAnimationOptionTransitionFlipFromRight 
       animations:^{ 
       [self.navigationController pushViewController:next animated:NO]; 
       } 
       completion:nil]; 
+0

要容易得多的解決方案。謝謝 –

1
UIView: + (void)transitionFromView:(UIView *)fromView toView:(UIView *)toView duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options completion:(void (^)(BOOL finished))completion