0

我的错误如下:

在 ViewList 中,我有下面的代码,它确实推动了 ViewManager;

- (Void) tableView: (UITableView *) tableView didSelectRowAtIndexPath: (NSIndexPath *) indexPath
{
     PropertyManagerViewController propertyManagerViewController * = [[PropertyManagerViewController alloc] initWithNibName: @ "PropertyManagerViewController" bundle: nil];
     [self.navigationController pushViewController: propertyManagerViewController animated: YES];

}

在 ViewManager 中创建 UITabBarController :

- (void) createTabBarController
{
       [ ShowTabBarController showTabBar : self.navigationController.tabBarController ] ;

        NSMutableArray * viewControllers = [ [ NSMutableArray alloc ] init ] ;
         UITabBarController * TabBarController = [ [ UITabBarController alloc ] init ] ;

        ViewController * viewController = [ [ ViewController alloc ] initWithNibName : @ " ViewController " bundle: nil ] ;
         UINavigationController * navigationController = [ [ UINavigationController alloc ] initWithRootViewController : ViewController ] ;
         [ ViewControllers addObject : navigationController ] ;

        ViewController2 viewController2 * = [ [ VisitDetailsViewController alloc ] initWithNibName : @ " ViewController2 " bundle: nil ] ;
         UINavigationController * navigationController2 = [ [ UINavigationController alloc ] initWithRootViewController : ViewController2 ] ;
         [ ViewControllers addObject : navigationController2 ] ;

         tabBarController.viewControllers = viewControllers ;
         self.navigationController.tabBarController.viewControllers = tabBarController.viewControllers ;

} .

在 ViewController 和 ViewViewController2 中都有这个方法来推送 ViewList。

-(void)pushTableList
{
    [ShowTabBarController hideTabBar:self.tabBarController];

    PropertyListViewController *propertyList = [[PropertyListViewController alloc] initWithNibName:@"PropertyListViewController" bundle:nil];    

[UIView beginAnimations:nil context:NULL];

    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    [UIView setAnimationDuration:0.75];
    [self.navigationController pushViewController:propertyList animated:NO];
    [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:self.navigationController.view cache:NO];

    [UIView commitAnimations];
}

我现在的问题是:

  • 当我在 ViewController2 pushTableList 中时,我要去 viewlist 。
  • 然后选择另一行,执行 push ViewManager 和显示给我的视图是最后一个,在本例中为 ViewController2。

更新 :

我想单击表格单元格,然后推送 ViewController。问题是:我单击单元格,当我推送到 ViewList 时,视图显示 ViewContoller 2(这是我拥有的最后一个视图)。

新更新

1 - 推送并创建 UITabBArController

-(Void) tableView: (UITableView *) tableView didSelectRowAtIndexPath: (NSIndexPath *) indexPath
{
    PropertyManagerViewController propertyManagerViewController * = [[PropertyManagerViewController alloc] initWithNibName: @ "PropertyManagerViewController" bundle: nil];
    [self.navigationController pushViewController: propertyManagerViewController animated: YES];

}
- (void) createTabBarController
{
    [ ShowTabBarController showTabBar : self.navigationController.tabBarController ] ;

    NSMutableArray * viewControllers = [ [ NSMutableArray alloc ] init ] ;
    UITabBarController * TabBarController = [ [ UITabBarController alloc ] init ] ;

    ViewController * viewController = [ [ ViewController alloc ] initWithNibName : @ " ViewController " bundle: nil ] ;
    UINavigationController * navigationController = [ [ UINavigationController alloc ] initWithRootViewController : ViewController ] ;
    [ ViewControllers addObject : navigationController ] ;

    ViewController2 viewController2 * = [ [ VisitDetailsViewController alloc ] initWithNibName : @ " ViewController2 " bundle: nil ] ;
    UINavigationController * navigationController2 = [ [ UINavigationController alloc ] initWithRootViewController : ViewController2 ] ;
    [ ViewControllers addObject : navigationController2 ] ;
    ViewController3 viewController3 * = [ [ VisitDetailsViewController alloc ] initWithNibName : @ " ViewController3 " bundle: nil ] ;
    UINavigationController * navigationController3 = [ [ UINavigationController alloc ] initWithRootViewController : ViewController2 ] ;
    [ ViewControllers addObject : navigationController3 ] ;

    tabBarController.viewControllers = viewControllers ;
    self.navigationController.tabBarController.viewControllers = tabBarController.viewControllers ;

}

在此处输入图像描述

2 - 选择 TabBarITem 访问详细信息并单击 UIBarButtonItem 属性列表

在此处输入图像描述

3 - 单击数据表的单元格。

在此处输入图像描述

4 - 这是我的问题。如果您回头看 tabbaritem 访问。我要你给我看 PropertyItem 在此处输入图像描述

4

1 回答 1

1

您可能想查看此文档:https ://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/AboutViewControllers/AboutViewControllers.html

一条非常重要的信息:UITabBarController 始终必须是顶级控制器!不允许将 UITabBarController 放在 UINavigationController 中。但是,您可以将 UINavigationController 放在 UITabBarController 中。关于 UINavigationController 的 pushViewController:animated: 方法的Apple 文档说:

压入堆栈的视图控制器。此对象不能是选项卡栏控制器的实例,并且它不能已经在导航堆栈上。

我希望这能为您指明正确的方向。

于 2013-10-18T20:05:21.237 回答