删除uitabbar控制器
我是iPhone新手,我的问题是我的应用程序中有一个UITabbar
。 它将在login后显示。当我要从我的应用程序注销时,要返回到login视图控制器,所以标签栏应该从显示在视图控制器中的login中删除。 那我该怎么做?
我试图隐藏标签栏,但没有奏效。
在appdelegate使您的loginView作为rootView控制器,login后使您的tabBar作为rootView,并在注销时从rootView中删除tabBar,并使loginView作为rootView。
要么
在.h文件中
@property (nonatomic,retain) UITabBarController *yourTabBar;
使函数添加tabBar实例-(void)addTabBar
在应用程序中委托此方法将所有视图添加到tabBar,不要将此作为子视图添加到窗口,只是使它。 并添加您的LoginView作为rootViewController。
在login后添加tabBar作为子视图
TUTAppDelegate *appdelegte =(TUTAppDelegate*)[[UIApplication sharedApplication]delegate]; [[appdelegte window]addSubview:[[appdelegte yourTabBar]view]];
并在注销button
TUTAppDelegate *appDelegate = (TUTAppDelegate *)[[UIApplication sharedApplication] delegate]; [[[appDelegate yourTabBar] view]removeFromSuperview]
你有没有试过在TabBar前面有一个modalViewController?
UIViewController类参考
关于视图控制器
这是我的loginbutton行动如何把它放在appdelegate,如果它放置appdelegate如何访问loginbutton
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];
在页面中设置sig,在不同的View或Xib中设置下一页。
给第二个Xib的UITabbar。
当logOut指向冷杉视图。
- UITabBarController / UINavigationController旋转问题
- 当我在xCode 5中validation我的应用程序时,获取错误的不当广告标识符使用情况
- 我的parsingtableviewsearch效率低下(swift / objectiveC)?
- 我不理解UIActivityViewController,或者当前的实现很糟糕?
- 设备轮换后iOS 11中的UITableViewCell操作被破坏
- 设置AVAudioTimePitchAlgorithmVarispeed为AVFoundationAudioSettings
- 如何在Xcode中显示构建时间
- 如何设置UITextfield的边框样式
- 如何在自定义表视图单元格中添加复选框?