views:

454

answers:

1

I am new to iphone development.I have created a view based application.Now i want tab bar in that view.The first view of the tab bar is a table view and the second view is the Web-view.All the tutorials explain only tab bar based application.Since i am using view based application i finding it really hard.How to achieve it by using interface builder.please guide me.Any Sample tutorials will be more useful.Please help me out.Thanks.

+1  A: 

Hi Warrior,

Try this one. This code for created a tab bar application in programmatically. So clicked the button it will open the tab bar in the view.

   -(IBAction) clkBtn:(id) sender
   { 

    UITabBarController *tabbar1 = [[UITabBarController alloc] init];

    firstViewController  *first = [[firstViewController alloc] initWithNibName:@"firstViewController" bundle:nil];

    UINavigationController *tabItem1 = [[[UINavigationController alloc] initWithRootViewController: first] autorelease];

    secondViewController  *second = [[secondViewController alloc] initWithNibName:@"secondViewController" bundle:nil];

    UINavigationController *tabItem2 = [[[UINavigationController alloc] initWithRootViewController: second] autorelease];

    tabbar1.viewControllers = [NSArray arrayWithObjects:tabItem1, tabItem2,nil]; 

    [self.view insertSubview:tabbar1.view belowSubview: first.view];

    [self presentModalViewController:tabbar1 animated:YES];

  }

Thanks,

Best of Luck.

Pugal Devan
Will this work for push view controller?
Warrior
@Warrior. Yes, because have added the navigation controller in the view. So it push the view.
Pugal Devan
Thanks.It is a very good answer
Warrior
Thanks pugal i solved the yesterday issue.
Warrior