【问题标题】:UINavigation Bar and UITabBar programmatically - All objects are disabled?以编程方式导航栏和 TabBar - 所有对象都被禁用?
【发布时间】:2010-11-06 04:12:03
【问题描述】:

好吧,这很奇怪,已经困扰我好几天了....我做对了(我认为)但是它

这一切都在 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];

我做错了什么。我无法让页面上的任何元素正常工作。我的当前页面上有一个按钮也不起作用。

【问题讨论】:

  • 您是否勾选了“启用用户交互”?
  • 这些都是以编程方式完成的......有没有办法在代码中做到这一点?
  • 更新:我还添加了这些 iines 希望修复它但仍然没有帮助:mycurrentpage.view.userInteractionEnabled = YES; iVacationTabBar.view.userInteractionEnabled = YES; navController.view.userInteractionEnabled = YES;

标签: iphone xcode uinavigationcontroller uitabbarcontroller


【解决方案1】:

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

我把线条颠倒了 我必须在标签栏之前添加导航控制器的子视图

【讨论】:

    猜你喜欢
    • 2012-09-15
    • 2015-07-13
    • 1970-01-01
    • 2020-12-10
    • 2020-02-09
    • 1970-01-01
    • 2014-03-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多