我是 iPhone 开发的新手,我的问题是UITabbar
我的应用程序中有一个。它会在登录后显示。当我想从我的应用程序中注销时,想要返回登录视图控制器,因此应该从显示的登录视图控制器中删除标签栏。那么我该怎么做呢?
我尝试隐藏标签栏,但没有奏效。
我是 iPhone 开发的新手,我的问题是UITabbar
我的应用程序中有一个。它会在登录后显示。当我想从我的应用程序中注销时,想要返回登录视图控制器,因此应该从显示的登录视图控制器中删除标签栏。那么我该怎么做呢?
我尝试隐藏标签栏,但没有奏效。
在 appdelegate 中将 loginView 设置为 rootView 控制器,登录后将 tabBar 设置为 rootView 并在注销时从 rootView 中删除 tabBar 并将 loginView 设置为 rootView。
或者
在 .h 文件中
@property (nonatomic,retain) UITabBarController *yourTabBar;
在应用程序委托中添加 tabBar 实例的功能-(void)addTabBar
此方法将您的所有视图添加到 tabBar,不要将此作为子视图添加到窗口,只需制作即可。并将您的 LoginView 添加为 rootViewController。
登录后将 tabBar 添加为 subView
TUTAppDelegate *appdelegte =(TUTAppDelegate*)[[UIApplication sharedApplication]delegate];
[[appdelegte window]addSubview:[[appdelegte yourTabBar]view]];
并在注销按钮处
TUTAppDelegate *appDelegate = (TUTAppDelegate *)[[UIApplication sharedApplication] delegate];
[[[appDelegate yourTabBar] view]removeFromSuperview]
这是我的登录按钮操作如何将其放入 appdelegate 以及是否将 appdelegate 放入登录按钮
UITabBarController *tabBarController = [[UITabBarController alloc] init ];
UINavigationController *statusNavigationController = [[UINavigationController alloc] init];
StatusViewController *statusViewController = [[StatusViewController alloc] initWithNibName:@"StatusViewController" bundle:nil];
statusViewController.title = @"Status";
statusViewController.tabBarItem.image = [UIImage imageNamed:@"status.PNG"];
statusViewController.searchText=@"";
[statusNavigationController pushViewController:statusViewController animated:YES];
UINavigationController *messageNavigationController = [[UINavigationController alloc] init];
MessageViewController *messageViewController = [[MessageViewController alloc] initWithNibName:@"MessageViewController" bundle:nil];
messageViewController.title = @"Messages";
messageViewController.tabBarItem.image = [UIImage imageNamed:@"message.PNG"];
messageViewController.searchText=@"";
[messageNavigationController pushViewController:messageViewController animated:YES]
[tabBarController addChildViewController:statusNavigationController];
[tabBarController addChildViewController:messageNavigationController
[self.navigationController pushViewController:tabBarController animated:YES];
在不同的 View 或 Xib 中设置登录页面和下一页。
给第 2 届 Xib 的 UITabbar。
当 logOut 指向第一个 View。