Iphone 不在AppDelegate中创建TabBarController

Iphone 不在AppDelegate中创建TabBarController,iphone,ios,objective-c,Iphone,Ios,Objective C,这是RegisterViewController.m部分 if ([message isEqualToString:@"registerOK"]){ self.findViewController = [[FindViewController alloc] initWithNibName:nil bundle:NULL]; self.friendViewController = [[FriendViewController alloc] initWithN

这是RegisterViewController.m部分

   if ([message isEqualToString:@"registerOK"]){

        self.findViewController = [[FindViewController alloc] initWithNibName:nil bundle:NULL];
        self.friendViewController = [[FriendViewController alloc] initWithNibName:nil bundle:NULL];
        self.goViewController = [[GoViewController alloc] initWithNibName:nil bundle:NULL];
        self.settingViewController = [[SettingViewController alloc] initWithNibName:nil bundle:NULL];

        self.findNavigationController = [[UINavigationController alloc] initWithRootViewController:self.findViewController];
        self.friendNavigationController = [[UINavigationController alloc] initWithRootViewController:self.friendViewController];
        self.goNavigationController = [[UINavigationController alloc] initWithRootViewController:self.goViewController];
        self.settingNavigationController = [[UINavigationController alloc] initWithRootViewController:self.settingViewController];
        //[self.findNavigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"nav-bar-background-light.png"] forBarMetrics:UIBarMetricsDefault];

        [self.findNavigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"nav-bar-background-light.png"] forBarMetrics:UIBarMetricsDefault];
        [self.friendNavigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"nav-bar-background-light.png"] forBarMetrics:UIBarMetricsDefault];
        [self.goNavigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"nav-bar-background-light.png"] forBarMetrics:UIBarMetricsDefault];
        [self.settingNavigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"nav-bar-background-light.png"] forBarMetrics:UIBarMetricsDefault];


        NSArray *allViewController = [[NSArray alloc] initWithObjects:self.findNavigationController,self.friendNavigationController,self.goNavigationController,self.settingNavigationController, nil];
        self.tabBarController = [[UITabBarController alloc] init];
        [self.tabBarController setViewControllers:allViewController];
        UIWindow *window = [UIApplication sharedApplication].keyWindow;
        [self.view addSubview:self.tabBarController.view];
        [window setRootViewController:self];
    }
我想在
RegisterViewController
中创建一个
TabBarController
。我怎么做?
AppDelegate.m
中,我有一个if,它可以:如果已经登录,那么创建
TabBarController
,如果没有转到
RegisterViewController
,那么如果注册完成,我想创建
TabBarController
。如何做到这一点?谢谢。

您只需在
tabBarController顶部显示您的登录和注册视图。通过
[self.tabBarController presentViewController:
等方式查看

在AppDelegate中公开方法,并像往常一样在那里创建tabbar。 并在需要时调用此方法:

[(ASAppDelegate *)[[UIApplication sharedApplication] delegate]yourMethod]

RegisterViewController不需要TabBar,我可以隐藏它吗?