Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get index path for a specific item #5

Closed
eytanbiala opened this issue Jul 22, 2015 · 3 comments
Closed

Get index path for a specific item #5

eytanbiala opened this issue Jul 22, 2015 · 3 comments

Comments

@eytanbiala
Copy link

What is the best way to get the tree index path for an item?

I looked through the code and the examples for a method like -(NSIndexPath *)indexPathForItem:(NSDictionary *)item;

@genkernel
Copy link
Owner

Almost! :)

All public API is in TreeTable.h file.

There is a method that does exactly what you asked:

  • (NSIndexPath *)treeIndexPathForItem:(UITableViewCell *)item;

Except it accepts a cell - not a dictionary.

@eytanbiala
Copy link
Author

Thanks! Unfortunately in the case I'm working on I don't have access to the cell, only the item

@genkernel
Copy link
Owner

I'm sure you know better than me how to make an index path from a data source item of yours.

If you want to convert general index path (2 indices) into multidimensional tree index path you can use:

  • (NSIndexPath *)treeIndexPathFromTablePath:(NSIndexPath *)indexPath;

and vice versa:

  • (NSIndexPath *)tableIndexPathFromTreePath:(NSIndexPath *)indexPath;

Make sure to check 3 other branches for extra examples on how to use this component.

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants