2017-07-27 146 views
0

我怎么能说TabbarViewControllers连接的viewController从简单的UIViewController这里简单的UIViewController嵌入的UINavigationController。我需要UINavigationController在将其中一个移动到其他viewController时提供的Push和Pop效果。在谷歌挖掘后,我发现推动标签栏视图控制器内导航堆栈不是一个很好的方式来构建应用程序。我尝试创建自定义事务动画,但它与UINavigation事务效果不同。请给出一些建议或解决方案。谢谢!!如何从嵌入导航控制器的简单视图控制器调用标签栏视图控制器?

+0

意味着你需要从普通视图控制器打开的UITabBarController,对不对? – Nirmalsinh

+0

是@Nirmalsinh。 –

回答

1

您可以直接将UITabbarController设置为窗口的rootViewController。

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; 
_tabObj = (TabbarViewController*) [storyboard instantiateViewControllerWithIdentifier:@"TabbarViewController"]; 
self.window.rootViewController = _tabObj; 

查看上述代码。

+0

另一个选项简单'现在modally'也可以工作 –

+0

目前modally不给动画像UINavigationController推动画 –

0

作为Nirmalsinh的答案,你可以设置视图控制器符合UITabBarControllerDelegate作为你的self.window.rootViewController,那么它应该有UITabBarController里面。

var tabBarController: UITabBarController 

,那么你可以在每个标签的导航和视图控制器的

let firstViewController = FirstViewController() 
let firstNavigationController = UINavigationController(rootViewController: firstViewController) 
// other setter 

tabBarController.viewControllers = [ 
    firstNavigationController 
] 

然后里面FirstViewController,您可以拨打

let secondViewController = SecondViewController() 
navigationController?.pushViewController(SecondViewController, animated: true) 
相关问题