这是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];
}
我想在TabBarController
中创建RegisterViewController
。我该怎么做?
在AppDelegate.m
我有if if:如果已经登录,则创建TabBarController
,如果没有,请转到RegisterViewController
,如果注册完成我想创建TabBarController
。这该怎么做?感谢。
答案 0 :(得分:0)
您可以在tabBarController.view
之后显示您的登录信息并在[self.tabBarController presentViewController:]
之上注册视图。
答案 1 :(得分:0)
在AppDelegate中创建公共方法并像往常一样在那里创建tabbar。 并在您需要的地方调用此方法:
[(ASAppDelegate *)[[UIApplication sharedApplication] delegate]yourMethod]