我试图做到这一点,以便当我在我的 xib 文件中设置的工具栏中的 UIButton 被按下时,一个新的控制器被加载到视图中。
我该如何实施?我曾尝试复制 FlipViewController,但我认为您只能拥有其中一个。
我试图做到这一点,以便当我在我的 xib 文件中设置的工具栏中的 UIButton 被按下时,一个新的控制器被加载到视图中。
我该如何实施?我曾尝试复制 FlipViewController,但我认为您只能拥有其中一个。
您可以使用这样的漂亮动画进行切换:(仅在 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];