我正在使用Apple的多个详细视图示例来设置一个带有主控制器的iPad拆分视图控制器应用程序 - 一个选项卡视图,每个选项卡包含一个表视图...但是在每个选项卡视图中我还想为用户提供选项单击调用模式segue的添加按钮以添加CoreData对象的新实例,该实例为该选项卡下的表视图提供数据。 我遇到的唯一问题是,当我将ViewController中的unwind segue链接到modConally时,会调用unwind方法,但不会从屏幕中删除ViewController。
我的第一个想法是尝试打电话
[self.navigationController dismissViewControllerAnimated:YES completion:^{}];在unwind方法中,有效 - 但是当您再次单击添加按钮时,会出现EXC_BAD_ACCESS(code = 1,adress == ...)错误,这很奇怪,因为应用程序不应该尝试访问任何可能已经被释放的对象,只是从故事板中初始化一个新的模态视图控制器实例?
任何帮助将不胜感激!
I am using Apple's multiple detail views example to set up an iPad split view controller app with a master controller - a tab view each tab containing a table view... However in each of these tab views I also want to give the user the option to click an add button which calls a modal segue to add a new instance of the CoreData object which is providing data for the table view under that tab. The only problem I'm having is that when I link up the unwind segue from the ViewController which is segued to modally the unwind method gets called, but doesn't remove the ViewController from the screen.
My first idea was to try calling
[self.navigationController dismissViewControllerAnimated:YES completion:^{}];Within the unwind method, which works - however when you next click the add button again you get a EXC_BAD_ACCESS (code = 1, adress==...) error, which is strange as nothing surely the app shouldn't be trying to access any objects which may have been dealloc'd but simply init'ing a new instance of the modal view controller from the Storyboard?
Any help would be greatly appreciated!
最满意答案
我有同样的问题...如果它是一个模态segue你先调用,那么你可以尝试调用dismissViewControllerAnimated:来自self,而不是来自self.navigationController:
[self dismissViewControllerAnimated:YES completion:nil];I had the same issue ... If it is a modal segue you were calling first, then you could maybe try to call dismissViewControllerAnimated: from self, not from self.navigationController :
[self dismissViewControllerAnimated:YES completion:nil];更多推荐
发布评论