0

我试图做到这一点,以便当我在我的 xib 文件中设置的工具栏中的 UIButton 被按下时,一个新的控制器被加载到视图中。

我该如何实施?我曾尝试复制 FlipViewController,但我认为您只能拥有其中一个。

4

1 回答 1

1
  1. iPad(不要在整个屏幕上使用 UINavigationController)。

您可以使用这样的漂亮动画进行切换:(仅在 app-delegate 中有效,除非您更改使用// works only in app delegate.

UIViewController *ctrl = [[UIViewController alloc] initWithNibName:@"someXIBStuff" bundle:nil];


    CAKeyframeAnimation *theAnimation = [CAKeyframeAnimation animation];
    theAnimation.values = [NSArray arrayWithObjects:
                           [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.12,1.12,1)],
                           [NSValue valueWithCATransform3D:CATransform3DMakeScale(1,1,1)],
                           nil];
    theAnimation.cumulative = YES;
    theAnimation.duration = 0.3;
    theAnimation.repeatCount = 0;
    theAnimation.removedOnCompletion = YES;


    theAnimation.timingFunctions = [NSArray arrayWithObjects:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn], 
                                    nil
                                    ];

    [self.window.layer addAnimation:theAnimation forKey:@"transform"];  

    CATransition *transition = [CATransition animation];
    transition.duration = 0.3;
    transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    transition.type = kCATransitionFade;
    transition.delegate = self;

    [self.window.layer addAnimation:transition forKey:nil]; 

    self.window.rootViewController = ctrl; // works only in app delegate
    [ctrl release];
  1. iPhone:使用UINavigationController(如果可能)。如果没有,您可以使用上面的示例。
于 2012-04-12T18:48:55.977 回答