views:

89

answers:

3

Hello,

Is there a Tree control available for the iphone?

I need to represent a tree with sub nodes in a tree, how can I do it?

Thanks

+2  A: 

No tree widget by default. It's basically not there because you shouldn't really need one and most cases it should probably be avoided.

A table navigation controller is the most common way to navigate down nodes in a hierarchy/tree usually.

It's hard to fit a tree like control we have on our desktops in the touch world where you have huge fingers (so huge nodes) and with the nodes offset to show depth, there isn't much space left over. Adding it to the iOS environment would create a weird UX flow so I would probably rethink my design flow if I think I need one.

If you need to fake it, you can use a table view and offset the left side of each subitem with some padding to show depth.

Zac Bowling
http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/TableView_iPhone/TableViewStyles/TableViewCharacteristics.html%23//apple_ref/doc/uid/TP40007451-CH3-SW1
Joshua Nozzi
I am looking for a control, a third party control. Not a view or the navigation.
Meir
Also work on that accept rate there :-) We answer for the points and e-credit :-P
Zac Bowling
A: 

I would use a UITableView and expand and collapse items further down the tree. You can set an indentation level for each UITableViewCell as it is displayed, depending on its position in the tree. You would need to keep track of which items in the tree are expanded/visible in order to always provide the tree with the correct data.

I just did just that for a project. Unfortunately I am not at liberty to share the full code. But it should not be terribly hard to write.

Let us know if you find an out-of-the-box solution.

Joseph Tura
A: 

From what I see, the best solution for my problem will be a BreadCrumbs control. I am looking for a ready solution of breadcrumbs, but if there isn't, it is not a big deal to write it.

Meir
answering your own question and accepting it is not cool man.
Zac Bowling