以编程方式导航栏和TabBar - 所有对象都被禁用?

时间:2010-11-06 04:12:03

标签: iphone xcode uinavigationcontroller uitabbarcontroller

好的,这很奇怪,现在已经困扰了我好几天....我做得对(我认为)但它

这一切都在AppDelegate中完成:

//Initialize the controllers

 navController = [[UINavigationController alloc]init];
 iVacationTabBar = [[UITabBarController alloc] init];


//Define the viewcontrollers

 myTools* vc_tools = [[myTools alloc] init];
 mySettings* vc_settings = [[mySettings alloc] init];
 aboutIVacation* vc_about = [[aboutIVacation alloc] init];
 myCurrent *mycurrentpage = [[myCurrent alloc] init];
//Create the array of controllers

 NSArray* controllers = [NSArray arrayWithObjects:mycurrentpage,  vc_tools,vc_settings, vc_about, nil];

//Add the view controllers to the tab bars:

 [iVacationTabBar setViewControllers: controllers animated:YES];

//Push the first view controller to the stack:

 [navController pushViewController: mycurrentpage animated:NO];

//Add the tabBar and navController to the window:

 [window addSubview:iVacationTabBar.view];
 [window addSubview:navController.view];

我做错了什么。我无法让页面上的任何元素发挥作用。我在mycurrentpage上有一个按钮也无效。

1 个答案:

答案 0 :(得分:0)

耶!!!从另一个论坛帖子的帮助解决了这个问题:

我的线条反转了 我必须在标签栏

之前添加导航控制器的子视图