moomoo
moomoo

Reputation: 77

Tab bar not appearing

The tab bar for this project isn`t showing up, instead it just shows a black screen.This tab bar is enter in pragmatically in application launch in app delegate.

main_tab=[[UITabBarController alloc]init];
viewcontroller = [[HomeViewController alloc]init];
viewcontroller.title =@"Home";
UINavigationController *nav =[[UINavigationController alloc]initWithRootViewController:viewcontroller];

viewcontroller1 = [[SearchViewController alloc]init];
viewcontroller1.title =@"Search";
UINavigationController *nav1 =[[UINavigationController alloc]initWithRootViewController:viewcontroller1];


tabs_array=[[NSArray alloc]initWithObjects:nav,nav1, nil];
main_tab.viewControllers=tabs_array;
[self.window addSubview:main_tab.view];
[self.window makeKeyAndVisible];

return YES;

Upvotes: 0

Views: 1378

Answers (1)

foundry
foundry

Reputation: 31745

Try replacing this line

   [self.window addSubview:main_tab.view];

With this

    self.window.rootViewController = main_tab;

Upvotes: 2

Related Questions