我的app是在AppDelegate里的- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions里生成多视图的
StrategyListViewController *viewController1 =[[StrategyListViewController alloc]init];
strategy.tabBarItem.title = @"111";
strategy.tabBarItem.image = [UIImage imageNamed:@"11.png"];
StrategyListViewController *viewController2 =[[StrategyListViewController alloc]init];
strategy.tabBarItem.title = @"222";
strategy.tabBarItem.image = [UIImage imageNamed:@"22.png"]; UINavigationController *Nav1 = [[UINavigationController alloc] initWithRootViewController:viewController1];
UINavigationController *Nav2 = [[UINavigationController alloc] initWithRootViewController:viewController2];
NSArray *navArray = [NSArray arrayWithObjects:Nav1, Nav2, nil];
UITabBarController *tabBarController = [[UITabBarController alloc]init];
tabBarController.viewControllers = navArray;
self.window.rootViewController = tabBarController;
现在我要在这之前添加一个登录页面,该在哪个地方加,请大侠指点,在线等,谢谢了,
StrategyListViewController *viewController1 =[[StrategyListViewController alloc]init];
strategy.tabBarItem.title = @"111";
strategy.tabBarItem.image = [UIImage imageNamed:@"11.png"];
StrategyListViewController *viewController2 =[[StrategyListViewController alloc]init];
strategy.tabBarItem.title = @"222";
strategy.tabBarItem.image = [UIImage imageNamed:@"22.png"]; UINavigationController *Nav1 = [[UINavigationController alloc] initWithRootViewController:viewController1];
UINavigationController *Nav2 = [[UINavigationController alloc] initWithRootViewController:viewController2];
NSArray *navArray = [NSArray arrayWithObjects:Nav1, Nav2, nil];
UITabBarController *tabBarController = [[UITabBarController alloc]init];
tabBarController.viewControllers = navArray;
self.window.rootViewController = tabBarController;
现在我要在这之前添加一个登录页面,该在哪个地方加,请大侠指点,在线等,谢谢了,
// tabBarController.viewControllers = navArray; 这句先不要
self.window.rootViewController = tabBarController;// 创建一个登录注册VC
loginVC = .....
在使用你的tabBarController
[tabBarController presentViewController:loginVC animated:NO completion:nil];
使用delegate等loginVC登录或注册正常返回后,关闭loginVC,再调用
tabBarController.viewControllers = navArray