Tab bar in view based application?

强颜欢笑 提交于 2019-12-01 10:16:07

问题


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:


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.



来源:https://stackoverflow.com/questions/2310251/tab-bar-in-view-based-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!