不知道这里发生了什么。
当我在 Action 中执行此操作以显示另一个 viewController 时:
CATransition* transition = [CATransition animation];
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
transition.duration = 1.0f;
transition.type = @"cube";
transition.subtype = @"fromRight";
[self.navigationController.view.layer removeAllAnimations];
[self.navigationController.view.layer addAnimation:transition forKey:kCATransition];
forgotLoginViewController = [[ForgotLoginViewController alloc]initWithNibName:@"ForgotLoginViewController" bundle:Nil];
[self.navigationController pushViewController:forgotLoginViewController animated:YES];
它不工作。但是,当我这样做时...(将子视图添加到视图中)
CATransition* transition = [CATransition animation];
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
transition.duration = 1.0f;
transition.type = @"cube";
transition.subtype = @"fromRight";
[self.view.layer removeAllAnimations];
[self.view.layer addAnimation:transition forKey:kCATransition];
forgotLoginViewController = [[ForgotLoginViewController alloc]initWithNibName:@"ForgotLoginViewController" bundle:Nil];
[self.view addSubview:forgotLoginViewController.view];
是吗?我的 Viewcontrollers 和 tabbar 在 appdelegate 中实现,如下所示
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
UIViewController *viewController1 = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
UIViewController *viewController2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
UINavigationController *navController = [[UINavigationController alloc]
initWithRootViewController:viewController2];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = @[viewController1, navController];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
任何建议表示赞赏。