代码之家  ›  专栏  ›  技术社区  ›  logixologist

UINavigation Bar和uitabar以编程方式-所有对象都被禁用?

  •  0
  • logixologist  · 技术社区  · 15 年前

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

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

    1 回复  |  直到 6 年前
        1
  •  0
  •   logixologist    15 年前

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

    我把台词颠倒了 我不得不在标签栏前添加导航控制器的子视图