//从购物车或商品详情购买商品进入
NSArray *pushVCAry=[self.navigationController viewControllers];
//下面的pushVCAry.count-3 是让我回到视图1中去
UIViewController *popVC=[pushVCAry objectAtIndex:pushVCAry.count-4];
[self.navigationController popToViewController:popVC animated:YES];
//得到当前视图控制器中的所有控制器
NSMutableArray *array = [self.navigationController.viewControllers mutableCopy];
//把B从里面删除
if (_isForgetPassword) {
[array removeObjectAtIndex:array.count - 3];
}else {
[array removeObjectAtIndex:array.count-2];
}
//把删除后的控制器数组再次赋值
[self.navigationController setViewControllers:[array copy] animated:YES];
网友评论