【问题标题】:Tab bar in view based application?基于视图的应用程序中的标签栏?
【发布时间】:2011-01-19 14:18:08
【问题描述】:

我是 iphone 开发新手。我创建了一个基于视图的应用程序。现在我想要那个视图中的标签栏。标签栏的第一个视图是表格视图,第二个视图是 Web 视图。所有教程仅解释基于标签栏的应用程序。由于我使用的是基于视图的应用程序,我发现它真的很难。如何使用界面生成器来实现它。请指导我。任何示例教程都会更有用。请帮助我。谢谢。

【问题讨论】:

  • 你能把它作为“标签栏应用程序”重新启动吗?
  • @Kristopher..我在 9 天前问了这个问题,而 pugal 在 7 天前问了他的问题。我怎样才能复制它?

标签: iphone cocoa-touch uiview uitabbar


【解决方案1】:

试试这个。此代码用于以编程方式创建标签栏应用程序。所以单击按钮它将在视图中打开选项卡栏。

   -(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];

  }

谢谢,

祝你好运。

【讨论】:

  • @Warrior。是的,因为在视图中添加了导航控制器。所以它推动了视图。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-08-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-09-05
  • 2011-04-14
相关资源
最近更新 更多