【发布时间】:2012-09-17 13:15:41
【问题描述】:
我是 iPhone 开发的新手,我的问题是我的应用中有一个 UITabbar。它会在登录后显示。当我想从我的应用程序中注销时,想要返回登录视图控制器,因此应该从显示的登录视图控制器中删除标签栏。那我该怎么做呢?
我尝试隐藏标签栏,但没有奏效。
【问题讨论】:
-
“问题”?你的意思是? --"退出离子"
标签: iphone objective-c ios xcode
我是 iPhone 开发的新手,我的问题是我的应用中有一个 UITabbar。它会在登录后显示。当我想从我的应用程序中注销时,想要返回登录视图控制器,因此应该从显示的登录视图控制器中删除标签栏。那我该怎么做呢?
我尝试隐藏标签栏,但没有奏效。
【问题讨论】:
标签: iphone objective-c ios xcode
在 appdelegate 中将 loginView 设为 rootView 控制器,登录后将 tabBar 设为 rootView 并在注销时从 rootView 中删除 tabBar 并将 loginView 设为 rootView。
或
在.h文件中
@property (nonatomic,retain) UITabBarController *yourTabBar;
在应用程序委托中添加tabBar实例-(void)addTabBar的函数将此方法添加到tabBar,不要将此作为子视图添加到窗口,只需创建即可。
并将您的 LoginView 添加为 rootViewController。
登录后添加tabBar作为子视图
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 时。
【讨论】: