开发者

Passing IndexPath between views

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 <NS开发者_StackOverflowIndexPath 0x4e1fdc0> 2 indexes [0, 0]


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:

"MyFile.h"
@property (nonatomic, retain) NSIndexPath *myPath;

"MyFile.m"

@synthesize myPath;

"MainView.m"
// After allocating the subview, or whenever you are going to show the subView
[mySubView setIndexPath:myPath];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜