當我在第三個視圖中觸摸取消按鈕時,我想直接返回到第一個視圖。我怎樣才能做到這一點?如何直接從第三個視圖返回到第一個視圖?
這是代碼。
// this part is in the first view.
SecondController *aSecondController = [[SecondController alloc] init];
UINavigationController *aNaviController = [[UINavigationController alloc] initWithRootViewController:aSecondController];
self.naviController = aNaviController;
[aNaviController release];
[aSecondController release];
[self.view addSubview:naviController.view];
// this part is in the second view.
ThirdController *thirdController = [[ThirdController alloc] initWithStyle:UITableViewStyleGrouped];
[self.navigationController pushViewController:thirdView];
[thirdView release];
// this part is in the third view.
- (void)cancel {
[self.navigationController popViewControllerAnimated:NO]; // this only goes to the second view.
}
popToViewController,popToRootViewController也只能轉到第二個視圖。
對不起,我最初沒有注意到有什麼不同。我給你的問題加了一票。 – zaph