我的申请是,我使用导航控制器,使用海关电算师提供等级数据。 然而,在我们的具体应用中,我们需要在每一页都有一个带子,让用户回到根基控制器网页。 为实现这一目的,我在所有海关观察控制人员中确定了一种发射方法,即:
- (void) launchHomePage {
[self.navigationController popToRootViewControllerAnimated:NO];
}
这完全是在SOS 4.2。 然而,在SOS4.3和Si05中,当家 but被点击时,它就显示一张空白表。 为了辩论这个问题,我试图看到导航管理员的电离辐射员名单,然后打电话叫PpopToRootViewController Animated。
- (void) launchHomePage {
if(self.navigationController) {
[self printViewControllers:[self.navigationController viewControllers]];
[viewController.navigationController popToRootViewControllerAnimated:NO];
} else {
NSLog(@"Couldn t retrieve navigationcontroller
");
}
}
- (void) printViewControllers:(NSArray *) viewControllers {
if(viewControllers) {
NSLog(@"Number of viewcontrollers in navigationController s array is %d
",
[viewControllers count]);
int i = 1;
for(UIViewController *viewController in viewControllers) {
NSLog(@"viewController %d is %@ and has title %@
", i++, viewController, [viewController title]);
}
}
}
对于同一执行顺序,以下是上述方法在OS5.0和OS.4.2中的输出:
iOS5:
Number of viewcontrollers in navigationController s array is 3
viewController 1 is <RootViewController: 0x86259c0> and has title (null)
viewController 2 is <RootViewController: 0x9115680> and has title MainPage
viewController 3 is <FirstPageViewController: 0x9141bd0> and has title FirstPage
iOS4.2:
Number of viewcontrollers in navigationController s array is 2
viewController 1 is <RootViewController: 0x624d520> and has title MainPage
viewController 2 is <FirstPageViewController: 0x651ce10> and has title FirstPage
I am not able to figure out how/why there is a blank page (with title null) as the root of the navigationController. Appreciate any help in figuring this out.