0

Im a newbie in ios , my app is a single view application (nib), the first view has 2 buttons , the first one open a uiview with 4 buttons , every button open a tabbar , (thats mean 4 bar button items ) ,

the views up show o.k.

at the second button in the first view , a view shows with 3 buttons every button open a tabbar , (thats mean 3 bar button items ) , the problem that when I pressed one of these 3 buttons the app get crashed and shows the error ([UITabBarController presentModalViewController:animated:completion:]: unrecognized selector sent to instance..)

I did the step at the second bar as what i did in the first !

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

   }

any help please? thank you

4

2 回答 2

0

[self presentViewController:tabBarControllerr 动画:YES 完成:nil];

于 2013-04-03T16:55:41.877 回答
0

看起来您有两个名称非常相似但名称不同的属性:

  • self.tabBarController(带一个“r”)
  • self.tabBarControllerr(带有两个 'r's)。

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

我会确保你的变量名不会让你感到困惑,然后我也会确保你的意思是调用presentModalViewController:animated正确的对象。

我不相信 aUITabBarController可以呈现自己。它需要呈现一个不同的UIViewController实例。

于 2013-04-03T16:08:01.037 回答