开发者

Tab bar in view based application?

开发者 https://www.devze.com 2022-12-21 07:48 出处:网络
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.

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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消