xcode 主视图控制器 -> 细节视图控制器通信
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10270664/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Master View Controller -> Detail View Controller Communication
提问by Alexander
Is there a possibility for access to the array defined in Master View Controller from Detail View Controller? I have a Master-Detail Application in xCode. In Master View Controller an Array is defined. In Detail View Controller there are detail informations according to one entry from this array.
是否有可能从细节视图控制器访问主视图控制器中定义的数组?我在 xCode 中有一个主从应用程序。在主视图控制器中定义了一个数组。在 Detail View Controller 中,根据该数组中的一个条目有详细信息。
Is it possible to get access from Detail View Controller to the array and update them?
是否可以从细节视图控制器访问数组并更新它们?
How can I pass the reference to the array from Master to Detail?
如何将数组的引用从 Master 传递到 Detail?
回答by Michael Dautermann
Is there any link whatsoever between your Master and Detail view?
你的主视图和细节视图之间有任何联系吗?
If so, then you can expose access to the array via making it a "@property
" of the Master View Controller that you can access from the Detail view controller.
如果是这样,那么您可以通过使其成为@property
主视图控制器的“ ”来公开对数组的访问,您可以从细节视图控制器访问它。
Here is a related question with answers that may help you out. I can't give you more specific answers than this because you haven't said how you've set up your Master <-> Detail View Controller implementation.
这是一个相关的问题,其答案可能对您有所帮助。我不能给你比这更具体的答案,因为你没有说你是如何设置你的主 <-> 细节视图控制器实现的。