Iphone UITabBar模态视图控制器
我试图在另一个TabBarController上呈现一个TabBarController。我的应用程序的MainWindow.xib如下所示:Iphone UITabBar模态视图控制器,iphone,ios,uitabbarcontroller,uitabbar,modalviewcontroller,Iphone,Ios,Uitabbarcontroller,Uitabbar,Modalviewcontroller,我试图在另一个TabBarController上呈现一个TabBarController。我的应用程序的MainWindow.xib如下所示: Files Owner First Responder My App App Delegate Window TabBarContoller +TabBar +Nav Controller Subclass (a custom class) +Navigation Bar +Table View Conto
Files Owner
First Responder
My App App Delegate
Window
TabBarContoller
+TabBar
+Nav Controller Subclass (a custom class)
+Navigation Bar
+Table View Contoller Subclass (custom class)
+Tab Bar Item
+Second View Controller (not yet hooked up)
NavigationBar
[ ]
[ ]
[---View---]
[ ]
[ ]
TabBar from the pushed view
TabBar from the root view
我试图在TableView中单击一个项目时显示一个xib文件。这个xib文件的主视图是TabBarController,但是当视图显示时,选项卡栏和导航栏都不可见。我用来显示它的代码是:
MyAppAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.customNavController presentModalViewController:customDetailEditViewController animated:YES];
如果我使用下面的代码将视图控制器推送到堆栈上,我会看到正确的导航栏,但是会显示根视图控制器中的选项卡栏,而不是已推送到的视图中的选项卡栏
[delegate.customNavController pushViewController:customDetailEditViewController animated:YES];
我甚至尝试删除TabBarController并手动实现我自己的TabBar委托,但出现了相同的效果(没有NavigationBar或TabBar,或者根ViewController中的NavigationBar/TabBar)
编辑:我已将源文件上载到。如果有人对iOS有更多的经验,我会非常感激
EDIT2:到目前为止,我最接近的方法是在第一个选项卡栏中显示一个模态视图控制器,因此我的视图如下所示:
Files Owner
First Responder
My App App Delegate
Window
TabBarContoller
+TabBar
+Nav Controller Subclass (a custom class)
+Navigation Bar
+Table View Contoller Subclass (custom class)
+Tab Bar Item
+Second View Controller (not yet hooked up)
NavigationBar
[ ]
[ ]
[---View---]
[ ]
[ ]
TabBar from the pushed view
TabBar from the root view
为了实现这一点,我使用了:
UITabBarController *tabBarController = [[UITabBarController alloc] init];
UIViewController *directionsView = [[UIViewController alloc] init];
txtDirections = [[UITextView alloc]initWithFrame:CGRectMake(0,0,self.view.frame.size.width, self.view.frame.size.height)];
[directionsView.view addSubview:txtDirections];
IconPickerViewController *iconPicker = [[IconPickerViewController alloc]init];
tabBarController.viewControllers = [NSArray arrayWithObjects:recipeDetailEditViewController,directionsView,iconPicker, nil];
[directionsView release];
[iconPicker release];
MyAppAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.rootNavController presentModalViewController:recipeDetailEditViewController animated:YES];
但这会使一切变得复杂,因为a)这并不理想,因为我有两个选项卡栏;b)所有控件(所有编辑控件)都需要位于TableViewController中,以便可以加载/保存它们的值以编辑项目。如果推式视图能够处理加载/保存并显示在根选项卡的顶部,则会容易得多
这肯定是可能的吗?你为什么把所有的东西都放在你的main.xib里?
尝试将第二个选项卡栏移出主窗口xib,而将其放在customDetailEditViewController中。这绝对是一场噩梦,但我最终通过在单击“添加”按钮时从TableViewController以模式显示视图使其工作:
[delegate.rootController presentModalViewController:recipeDetailEditViewController animated:YES];
delegate.rootController是根TabBarController
我展示的XIB文件没有TabBarController,而是一个UIView、一个导航栏和一个TabBar。当从NavigationController内部以模式显示时,这似乎起作用。
它不在主xib中。有主xib,然后是第一个导航consoller,这是另一个xib,然后是我的CustomEditViewController,这是另一个xib。谷歌正在检测mi6.nu地址的恶意软件。是的,它正在等待审查,但是文件是安全的。我无法让你的项目以任何有用的方式运行。(它只是挂在准备时间选择器视图中)。我认为您应该做的第一件事是将编译器警告标志设置为YES,并获得一个干净的构建。即使这不能解决您当前的问题,它也会阻止将来出现更多问题。