Iphone 不在AppDelegate中创建TabBarController
这是RegisterViewController.m部分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
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,我可以隐藏它吗?