我有我我推從viewcontroller.testviewcontroller一個testviewcontroller已經後退按鈕和肯定button.when按下時使用在導航堆棧中找不到推動的視圖控制器?
[self.navigationController popViewControllerAnimated:YES];
按後退按鈕我要回以前的應用程序Yes按鈕我正在推動使用
GettingViewController *get =[[GettingViewController alloc] initWithNibName:@"GettingViewController" bundle:nil];
[self.navigationController pushViewController:get animated:NO];
另一個視圖控制器這是按下一個按鈕,我正在坡平當所有工作fine.in的rewardsget回testviewcontroller.using這個`
for (TestViewController*vc in [self.navigationController viewControllers]) {
if ([vc isKindOfClass: [TestViewController class]]){
[[self navigationController] popToViewController:vc animated:YES];
}
}
`
但是當我在該視圖中按後退按鈕它需要去我的新推視圖控制器,即rewardsget.But當我打印視圖控制器它不存在於stack.so它再次回來到第一個推動視圖控制器,不是最新的。任何人都可以幫助我呢?
嘗試在你的循環內添加NSLog,你的循環是否執行? – janusbalatbat 2012-08-16 05:40:20
ya它的工作。這不是問題。當我在後退按鈕中打印viewcontrollers它不是打印rewardsget.that我已經push.thats問題。 – hacker 2012-08-16 05:44:22
@bugfinder我認爲你採取了本地變量;所以它在功能/方法失效時被釋放;所以儘量提供屬性合成並檢查一次; – alishaik786 2012-08-16 05:48:55