2013-12-19 30 views
0

在我设置UIViewControllerAppDelegate,让我们把它VC,为rootViewControlloer我的应用程序:如何在不使用UINavigationController的情况下交换window.rootViewController?

-(BOOL) application: (UIApplication*) application didFinishLaunchingWithOptions: (NSDictionary*) launchOptions 
{ 
    self.window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]]; 

    UIViewController *VC = [UIViewController alloc] init]; 
    self.window.rootViewController = vc; 

    [self.window makeKeyAndVisible]; 
    return YES; 
} 

一旦VC在屏幕上,它要求用户一对夫妇的问题,以便更好在真正使用之前配置应用程序。

只要我知道用户想要什么,我需要换VCUITabBarController,姑且称之为TBC,有三个固定的UINavigationController它。

如何从VC 中推送TBC而不是将VC放入UINavigationController然后用它来推送TBC?

我已经能够完成互换使用UINavigationController。我想直接从transiction VC到TBC,作者elf.window.rootViewController whitout需要使用额外的UINavigationController的交换。

+0

什么样的视觉效果?动画还是直接?你有没有尝试过交换根VC的建议? – Wain

回答

0

相反通过视图控制器导航刚刚创建应用程序委托的方法,其将所述用户之后改变根控制器如

-(void)showTBC 

{ 
    self.TBC=[[UITabbarcontroller alloc]init]; 

    [self.window setRootViewController:self.TBC]; 
    [self.window makeKeyAndVisible]; 

} 

和书房在VC中选择的回答使应用程序的一个实例在VC委派 如

AppDelegate *ap=(AppDelegate *)[[UIApplication sharedApplication]delegate]; 

和呼叫 [AP showTBC];

...它为我工作..给它一个尝试...

相关问题