2013-06-24 59 views
0

我有這樣的代碼,其示出了兩個視圖控制器但問題之間的過渡是我要顯示由右至左像以推送視圖控制器過渡....帶上viewfrom從右到左

 UIViewController *previousController = [self.childViewControllers objectAtIndex:[self.childViewControllers count]-2]; 
    [self transitionFromViewController:previousController toViewController:controller duration:0.5 options:UIViewAnimationOptionAllowAnimatedContent animations:NULL completion:NULL]; 

任何幫助,將不勝感激

回答

1

我認爲這是更好的方法,你想要什麼,

NSMutableArray *vcs = [NSMutableArray arrayWithArray:self.navigationController.viewControllers]; 
       UIViewController *previousController = [self.childViewControllers objectAtIndex:[self.childViewControllers count]-2]; 

      [vcs insertObject:previousController atIndex:[vcs count]-1]; 
      [self.navigationController setViewControllers:vcs animated:NO]; 
     [self.navigationController popViewControllerAnimated:YES]; 
1

您可以使用這樣的事情...

(需要< QuartzCore/QuartzCore.h>)

CATransition *animation = [CATransition animation]; 
    [animation setDuration:0.5]; 
    [animation setType:kCATransitionPush]; 

     [animation setSubtype:kCATransitionFromLeft]; 
    [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; 

    [[previousController layer] addAnimation:animation forKey:@"SwitchToView"]; 
相關問題