1

I'm new in mono touch iOS/monotouch development. I want to make multi-level table in my app, but don't know how.. i've tried to search web, but found nothing (except ancient 2009 year's sample which does not work).

Let we have table:

  • row1
  • row2
  • row3

User taps on row2 and it expands:

  • row1
  • row2
  • [subrow1]
  • [subrow2]
  • row3

If user tap row2 again, it collapses.

I know, realization should be quite easy, but I have no experience in it right now. It will be great to get some assistance!

Thanks in advance.

Alex
  • 105
  • 6
  • there is no native support for this in iOS. You could probably achieve something similar by using a custom table cell. – Jason May 17 '12 at 19:22

1 Answers1

0

There is no built-in / default control in iOS that behaves like a TreeView (e.g. in System.Windows.Forms). This is largely because this requires a bit more screen space than an iPhone/iPod has.

The common solution is to use tables, e.g. add a ">" in your cell (which can be expanded) and show a new controller the data (either a table or something else).

Another options is to find (and bind) some custom controls that offers a treeview-like controls (there are some listed in the previous link) or, like @Jason said, implement something similar out of an UITableView and related-types.

Community
  • 1
  • 1
poupou
  • 43,413
  • 6
  • 77
  • 174
  • Thanks! So you suggest to show(insert) table in selected cell by tap.. Sounds good! I'll try to find more info/examples for that. – Alex May 17 '12 at 19:46
  • Yep, that would work, as long as there's not too many cells (e.g. thousands). – poupou May 17 '12 at 19:55
  • If going the route of just navigating to a new screen as suggested by @poupou, then check out MonoTouch.Dialog. It makes creating table navigation a lot easier. – valdetero May 17 '12 at 20:00
  • No, my goal to show extra rows (details of selected row) on same screen just between selected row and next one. There are so many code samples of navigating between screens and nothing about my case! I've found solutions for Objective C: http://stackoverflow.com/questions/3066167/accordion-table-cell-how-to-dynamically-expand-contract-uitableviewcell but don't know how to apply it for monotouch. – Alex May 17 '12 at 20:11