本文介绍了在推送视图上删除标签栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在app delegate中添加了标签栏。当我从我的一个视图推动视图时,标签栏被删除。我也希望推出视图上的标签栏。

i have added tab bar in app delegate. When i pushed the view from one of my view te tab bar got removed. I want that tab bar on pushed view also.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
    AudioViewController * audioViewController = [[AudioViewController alloc] initWithNibName:@"AudioViewController" bundle:nil];
    audioViewController.title = @"audio";
    audioViewController.tabBarItem.image=[UIImage imageNamed:@"audio 30x30.png"];

    ViewController *videoViewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
    videoViewController.title = @"video";
    videoViewController.tabBarItem.image=[UIImage imageNamed:@"video 30x30.png"];   

    ViewController *aboutViewController = [[ViewController alloc]initWithNibName:@"ViewController" bundle:nil];
    aboutViewController.title = @"about";
    aboutViewController.tabBarItem.image=[UIImage imageNamed:@"about1_iPhone.png"];

    ViewController *infoViewController = [[ViewController alloc]initWithNibName:@"ViewController" bundle:nil];
    infoViewController.title = @"info";
    infoViewController.tabBarItem.image=[UIImage imageNamed:@"info 30x30.png"];

    PlaylistViewController *PlaylistViewControllerObj = [[PlaylistViewController alloc]initWithNibName:@"PlaylistViewController" bundle:nil];
    PlaylistViewControllerObj.title = @"Playlist";
    PlaylistViewControllerObj.tabBarItem.image=[UIImage imageNamed:@"ko.png"];

    NSArray *viewControllerArray = [NSArray arrayWithObjects:audioViewController,videoViewController,aboutViewController,infoViewController,PlaylistViewControllerObj,nil];

    UITabBarController * myTabbarController = [[UITabBarController alloc] init];
    [myTabbarController setViewControllers:viewControllerArray];
    navigationControllerObj = [[UINavigationController alloc] initWithRootViewController:myTabbarController];
    [navigationControllerObj setNavigationBarHidden:YES animated:NO];
    self.window.rootViewController =navigationControllerObj;
}


推荐答案

UIViewController * viewController1,* viewController2 ,* viewController3,* viewController4,* viewController5;

UIViewController *viewController1, *viewController2, *viewController3 , *viewController4 , *viewController5 ;

viewController1 = [[Homeviewcontroller alloc] initWithNibName:nil bundle:nil];
viewController2 = [[NearbyViewController alloc] initWithNibName:nil bundle:nil];
viewController3 = [[SearchViewController alloc] initWithNibName:nil bundle:nil];
viewController4 = [[FavoritiesViewController alloc] initWithNibName:nil bundle:nil];
viewController5 = [[MoreViewController alloc] initWithNibName:nil bundle:nil];

 UINavigationController *homeNavi=[[UINavigationController alloc]initWithRootViewController:viewController1];

 UINavigationController *SearchNavi=[[UINavigationController alloc]initWithRootViewController:viewController3];

 UINavigationController *NearbyNavi=[[UINavigationController alloc]initWithRootViewController:viewController2];

 UINavigationController *FavNavi=[[UINavigationController alloc]initWithRootViewController:viewController4];

 UINavigationController *MoreNavi=[[UINavigationController alloc]initWithRootViewController:viewController5];

 TabbarController = [[UITabBarController alloc] init];

 TabbarController.viewControllers = [NSArray arrayWithObjects:homeNavi,SearchNavi,NearbyNavi,FavNavi,MoreNavi, nil];



[self presentModalViewController:TabbarController animated:YES];

这篇关于在推送视图上删除标签栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 05:19