cmgrd
cmgrd

Reputation: 129

How to design an expandable view with tableview content?

I have a client that would like this implemented: https://i.sstatic.net/BV0em.png

X expandable views each with a scrollable tableview with Y cells. The main view is not scrollable. If i tap Drawer C then Drawer A should collapse and Drawer C should expand.

I've seen similar constructs, but not with tableviews inside, so I don't know exactly how to go around this.

What's the best approach to this?

1) A tableview with "inner" tableviews

2) Multiple customs views with a button and a tableview

3) Something other?

How would you implement this?

Thx!

Upvotes: 0

Views: 688

Answers (1)

Saraswati
Saraswati

Reputation: 1526

I have done this type of implementation but dont carry source code with me.. still i can guide u the way i did it... i will explain u the way i did and considering ur example image.

  1. u will need 3 buttons (give them diff tags) with 3 bool flags to handle their on off state.
  2. u will need 3 tableview(give them diff tags)
  3. if screen height is 480 and all button height is 20, then remaining height will be 480-3*20=420. so this is the height of all the table view.
  4. on the click event of any button ,based on clicked button tag find its associated table view .
  5. set the flag value on button click and using the bool flags value decide to show and hide the table view and also the on/off image on the button.

Upvotes: 4

Related Questions