我有一个带有列表的集合视图控制器。我在新的视图控制器中打开一个项目:
self.detailController = [_theStoryboard instantiateViewControllerWithIdentifier:@"DetailController"];
//init data
[self presentViewController:_detailController animated:YES completion:nil];
模态视图正确加载。但是,如果我关闭此视图并打开另一个项目,则会收到错误消息:
*** -[DetailViewController isKindOfClass:]: message sent to deallocated instance 0xb3e2200
通过调试,我已经对视图控制器进行了 nslog 操作:
NSLog(@"controller:%@", _detailController);
[self presentViewController:_detailController animated:YES completion:nil];
输出:
controller:<DetailViewController: 0xb3e2200> //first item
controller:<DetailViewController: 0xa3d0a00> //second item
//error here, because it attempts to present the view controller at address 0xb3e2200, instead of the second item.
任何人都可以就为什么会发生这种情况提供任何建议吗?这仅发生在 iPad 模拟器中,但出于某种原因也可以按预期用于 iPhone 版本......?