在视图之间传递 IndexPath
我试图将子视图的索引路径传递到主视图。我是通过我已经设置的委托和协议来执行此操作的,我只是稍微编辑了我调用的接受索引路径的方法..所以一切似乎都正常工作,但是当我从两个视图执行 NSLog 时,我得到下面的输出在我的终端中..我想知道“0x4e1fdc0”在输出中代表什么剂量?那是一个内存指针还是什么?
现在我在主视图中已经选择了索引路径,如果用户决定返回子视图,我如何将其传递回子视图?我是否需要制定新的委托/协议来转发信息?或者我可以用另一种方式来做吗..
2011-09-28 15:02:13.672 Code[14139:207] First View <NSIndexPath 0x4e1fdc0> 2 indexes [0, 0]
2011-09-28 15:02:13.673 Code[14139:207] Second View <NSIndexPath 0x4e1fdc0> 2 indexes [0, 0]
I am trying to pass the indexpath of my subview over to my main view. I am doing this through delegates and protocols that I have alread set up, I have just slightly edited the method I call to accept the indexpath.. so everything seems to work correctly however when I do the NSLog from both views I get the output below in my terminal.. I would like to know what dose the "0x4e1fdc0" represent in the output? is that a memory pointer or something?
Also now that I have the selected indexpath in my mainview, if the user decides to go back to the subview how can i pass it back to the subview? do I need to make a new delegate/protocol to pass the information forward? or can I do it another way..
2011-09-28 15:02:13.672 Code[14139:207] First View <NSIndexPath 0x4e1fdc0> 2 indexes [0, 0]
2011-09-28 15:02:13.673 Code[14139:207] Second View <NSIndexPath 0x4e1fdc0> 2 indexes [0, 0]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,这就是内存指针,NSIndexPath 只是嵌套数组集合树中节点的路径,因此 0, 0 表示数组 1 中的位置 0,然后是数组 2 中的位置 0。
NSIndexPath参考
您可以使用依赖注入将其传递给子视图,所以基本上只需在你的子视图:
Yes that is the memory pointer, a NSIndexPath is just a path to a node in a tree of nested array collections, so 0, 0, means position 0 in array 1 and then position 0 in array 2.
NSIndexPath reference
You can pass it to the subview using Dependency Injection so basically just declare this on your subview: