0
在VC1中嗨我有一个NSMutableArray显示结果。即使用户点击到不同的选项卡(因此他们不必再次搜索),直到用户再次搜索,我仍然希望保持该阵列活着。如何在切换到其他视图控制器时保持NSArray可用
我有一个强大的指针,但它似乎卸载时,我离开了视图。
没有太多的代码来显示(_resultsArray从以前的控制器使用代理设置,所以它已经结果加载)
- (void)viewDidLoad
{
[super viewDidLoad];
_resultsTableView.dataSource=self;
_resultsTableView.delegate=self;
[self.navigationController.navigationBar setHidden:YES];
}
//then standard tableview delegate methods...
此代码是试图找出如何Segue公司标签栏分享信息。 (在prepareforsegue)
当前在搜索VC。现在我有了我想要给resultsIndexVC的结果。下面的代码尝试这一点。 这是放置在当前(搜索VC)准备segue。
ResultsIndexViewController* vc = [[ResultsIndexViewController alloc] init];
UITabBarController* tbc = [segue destinationViewController];
vc = (ResultsIndexViewController *)[[tbc customizableViewControllers] objectAtIndex:1];
vc.SearchDelegate=self;//crash here (normally works if using regular segue)
vc.resultsArray = _temporaryResultsArray;
vc.originalQuery=_queryArray;
感谢
显示您的代码。 – Apurv
当你回到它时,你正在创建一个VC1的新实例吗? – rdelmar
为什么不在'AppDelegate'中保留'NSMutableArray'? – Sumanth