我想在另一个TabBarController上呈现一个TabBarController。我的应用程序的MainWindow.xib文件看起来是这样的:UITabBar模态ViewContoller
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)
我想,当点击TableView中的项目,显示厦门国际银行文件。这个xib文件有一个TabBarController作为主视图,但是当显示视图时,标签栏和导航栏都不可见。我使用以显示它的代码是:
MyAppAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.customNavController presentModalViewController:customDetailEditViewController animated:YES];
如果我使用下面的代码视图控制器推入栈中,我看到正确的导航栏,但被示出从根视图控制器的TabBar而不是从被推送的视角来看。
[delegate.customNavController pushViewController:customDetailEditViewController animated:YES];
我甚至试图消除TabBarController并手动执行自己的TabBar代表但是出现同样的效果(或者没有导航栏或的TabBar,或从根的ViewController所述导航栏/的TabBar)。
编辑:我已将源码上传到http://mi6.nu/tabcontroller.zip。如果有人对iOS有更多的经验可以看看,我会非常感激。
EDIT2:到目前为止,我来最接近的是呈现先的TabBar内模态的视图控制器,所以我的看法是这样的:
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];
这只是复杂的一切,虽然,因为)这不是理想的,因为我有两个tabbars和b)所有控件(所有的编辑控件)必须在TableViewController因此它们的值可以加载/保存编辑项目。如果推送的视图可以处理加载/保存并出现在根标签的顶部,将会容易得多。
当然,这一定是可能的?
它不在主xib中。有主要的xib,然后是第一个导航constoller这是另一个xib,然后我的CustomEditViewController,这是另一个xib。 – Echilon 2011-05-22 06:03:39
Google正在mi6.nu地址处检测到恶意软件。 – Rayfleck 2011-05-22 14:53:17
是的,它正在等待审查,但文件是安全的。 – Echilon 2011-05-22 15:30:42