-1

我是 iPhone 开发的新手,我的问题是UITabbar我的应用程序中有一个。它会在登录后显示。当我想从我的应用程序中注销时,想要返回登录视图控制器,因此应该从显示的登录视图控制器中删除标签栏。那么我该怎么做呢?

我尝试隐藏标签栏,但没有奏效。

4

4 回答 4

2

在 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]
于 2012-09-17T13:27:17.040 回答
0

这是我的登录按钮操作如何将其放入 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];
于 2012-09-18T06:18:02.183 回答
0

在不同的 View 或 Xib 中设置登录页面和下一页。

给第 2 届 Xib 的 UITabbar。

当 logOut 指向第一个 View。

于 2012-09-18T07:39:34.030 回答
0

你试过在 TabBar 前面有一个 modalViewController 吗?

UIViewController 类参考

关于视图控制器

于 2012-09-17T17:39:58.377 回答