只需将此波纹管方法粘贴到您的AppDelegate.m
文件中,并在您想要更改时调用特定方法UINavigationController
...
例如:如果你在v2
并且N1
通知改变了然后调用波纹管方法像波纹管......
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate setRootViewControllerN2];
使用下面的方法来切换带有动画的导航控制器..
1. setRootViewControllerN1 : 这是用于设置 RootViewController 和 N1 导航控制器。
-(void)setRootViewControllerN1{
self.window.rootViewController = N1;
[self.window makeKeyAndVisible];
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setType:kCATransitionFade];
[animation setDuration:0.5];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:
kCAMediaTimingFunctionEaseInEaseOut]];
[[self.window layer] addAnimation:animation forKey:kAnimationKey];
}
2. setRootViewControllerN2 : 这是用于设置 RootViewController 和 N2 导航控制器。
-(void)setRootViewControllerN2{
self.window.rootViewController = N2;
[self.window makeKeyAndVisible];
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setType:kCATransitionFade];
[animation setDuration:0.5];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:
kCAMediaTimingFunctionEaseInEaseOut]];
[[self.window layer] addAnimation:animation forKey:kAnimationKey];
}