0

这是 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];
    }

我想创建一个TabBarControllerin RegisterViewController。我该怎么做?在AppDelegate.m我有一个 if :如果已经登录然后创建TabBarController,如果没有去RegisterViewController,那么如果注册完成我想创建TabBarController。这个怎么做?谢谢。

4

2 回答 2

0

在 AppDelegate 中创建公共方法并像往常一样创建标签栏。并在需要的地方调用此方法:

[(ASAppDelegate *)[[UIApplication sharedApplication] delegate]yourMethod]
于 2013-03-04T12:57:05.077 回答
0

tabBarController.view您可以只显示您的登录名并在by[self.tabBarController presentViewController:]或诸如此类的顶部注册视图。

于 2013-03-04T12:33:49.350 回答