2013-04-03 50 views
0

林在IOS新手viewbased应用,我的应用程序是单个视图应用(笔尖),所述第一视图有2个按钮,第一个打开一个UIView与4个按钮,每个按钮打开的TabBar,(那意味着4个栏按钮项目),与tabbarcontroller

的意见了显示OK

在第一个视图的第二个按钮中,一个视图用3个按钮显示每个按钮打开一个tabbar(这意味着3个bar按钮项),当我按下这3个按钮之一时,应用程序崩溃,显示错误([UITabBarController presentModalViewController:animated:completion:]:无法识别的选择器发送到实例..)

我在第二个酒吧做了一步,就像我在第一个做的那样!

-(IBAction)goabout{ 
UIViewController *view1 = [[[about alloc] initWithNibName:@"about" bundle:nil] autorelease]; 
UIViewController *view2 = [[[collages alloc] initWithNibName:@"collages" bundle:nil] autorelease]; 
UIViewController *view3 = [[[centers alloc] initWithNibName:@"centers" bundle:nil] autorelease]; 
    self.tabBarControllerr = [[UITabBarController alloc] init]; 
    self.tabBarControllerr.viewControllers = [NSArray arrayWithObjects: view1, view2,view3, nil]; 
    [self.tabBarController setSelectedIndex:0]; 
    [self.tabBarControllerr presentModalViewController:tabBarControllerr animated:NO completion:nil]; 

    } 

请帮忙吗? 谢谢

+0

什么是你想用做[self.tabBarControllerr presentModalViewController:tabBarControllerr动画:NO完成:零]它看起来像标签栏控制器试图呈现自己。 – rdelmar

回答

0

它看起来像你有两个特性非常相似,但不同的名称:

  • self.tabBarController(有一个 'R')
  • self.tabBarControllerr(有两个“R的)。

然后,在goabout你叫presentModalViewController:animatedself.tabBarContollerr,并传递给它self.tabBarControllerr

我将确保您的变量名称不混淆你,我还要然后确保你的意思是叫presentModalViewController:animated上适当的对象。

我不相信一个UITabBarController可以提出自己。它需要提供不同的UIViewController实例。

+0

首先感谢你,两个uitabbarControllers是不同的,所以我把不同的名字。 – Norah

+0

查看我的编辑:UITabBarController实例正试图呈现自己。那是你的意思吗? – Aaron

+0

你可以提供你的应用程序的屏幕截图?它很难理解你想要做什么。你真的想用一个空视图模态地呈现一个标签栏控制器吗? – Aaron

0

[自presentViewController:tabBarControllerr动画:YES完成:无];

+0

如果您已解决问题,请标记答案,以便大家都知道。 – Aaron