我有一個導航控制器,推一些viewcontroller。它工作正常,但我不能清晰的導航控制器棧,所以我已經得到了內存不足的警告......清除導航控制器堆棧時推ViewController
這是我想做的事:
Viewcontroller 1 : HomeViewController
ViewController 2 : LandingPageViewController
ViewController 3 : DetailsInnovViewController
homeViewController -> Push -> landingPageViewController -> Push -> detailsPageViewController -> Push -> homeViewController
它的工作原理,但我希望有一個新的homeViewController,不是舊的。它可以從導航控制器中刪除。
這裏是我推homeViewController從detailsPageViewController我navigationController:
- (void)pushHomeVC
{
[LoginModel incrementCountedInnov];
for (UIViewController* vc in self.viewControllers) {
if ([vc isKindOfClass:[DetailsInnovViewController class]]) {
DetailsInnovViewController* dpvc = (DetailsInnovViewController*)vc;
[dpvc bannerHide];
break;
}
}
for (UIViewController* vc in self.viewControllers) {
if ([vc isKindOfClass:[HomeViewController class]]) {
[self popToRootViewControllerAnimated:NO];
[self pushViewController:vc animated:YES];
break;
}
}
}
THX的幫助!
可惜HomeViewController未設置爲根... – testoverblaireau