Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How can i load data into this tableView from my arrays

devcoderdevcoder Posts: 7New Users
I want to display the data in a way like this in my TableVIew. I have 3 sets of arrays

1. Category Arrays
2. Album Arrays
3. Track Arrays

Category1 may contains many Albums and each Album contains many tracks .... Category2 may contains many Albums and each Album contains many tracks ....

how can i configure the section and rows in my tableView. Any one give me an idea how can i do it

1.CATEGORY 1

ALBUM1

Track 1

Track 2

ALBUM2

Track 1

Track 2

2.CATEGORY 2

ALBUM1

Track 1

Track 2

.... and son on


PHjgM.png
Post edited by devcoder on

Replies

  • ebender001ebender001 Posts: 163Registered Users @ @
    edited November 2011
    devcoder wrote: »
    I want to display the data in a way like this in my TableVIew. I have 3 sets of arrays

    1. Category Arrays
    2. Album Arrays
    3. Track Arrays

    Category1 may contains many Albums and each Album contains many tracks .... Category2 may contains many Albums and each Album contains many tracks ....

    how can i configure the section and rows in my tableView. Any one give me an idea how can i do it

    1.CATEGORY 1

    ALBUM1

    Track 1

    Track 2

    ALBUM2

    Track 1

    Track 2

    2.CATEGORY 2

    ALBUM1

    Track 1

    Track 2

    .... and son on

    There is a UITableViewDelegate method for that:
    - (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath
    

    Ed
  • devcoderdevcoder Posts: 7New Users
    edited November 2011
    i doesn't means the Indenting .... What i want to know is how can i add and delete the rows if appropriate rows are selected ... like expanding and collapsing ...
  • Duncan CDuncan C Posts: 9,022Tutorial Authors, Registered Users @ @ @ @ @ @ @
    edited November 2011
    devcoder wrote: »
    i doesn't means the Indenting .... What i want to know is how can i add and delete the rows if appropriate rows are selected ... like expanding and collapsing ...

    So you want each category to be empty initially, with a disclosure triangle on it? Then, when the user taps on it, you want it to "open up" and display the data for that category?

    We do something very much like that in the help system for our apps "Kevin and Kell" and "Save My Place". (Save My Place is only $0.99. You might want to download it to see if its help (info) screen is doing what you want)

    What we do is create an array of booleans "section is open" for each section of items.
    If a section is not open, we return 1 in response to the numberOfRowsInSection data source call for that section.
    (The only row is the section heading with the disclosure button.)

    If the user taps a section, we change a flag to indicate that that section is now "open," and insert the extra rows for that section into the table view using the insertRowsAtIndexPaths:withRowAnimation: method.
    Regards,
    Duncan C
    WareTo

    widehead.gif
    Animated GIF created with Face Dancer, available for free in the app store.

    I'm available for one-on-one help at CodeMentor
  • dany_devdany_dev Posts: 4,696Tutorial Authors, Registered Users @ @ @ @ @
    edited December 2011
  • michellemichelle Posts: 210Registered Users
    edited December 2011
    Duncan C wrote: »
    So you want each category to be empty initially, with a disclosure triangle on it? Then, when the user taps on it, you want it to "open up" and display the data for that category?

    We do something very much like that in the help system for our apps "Kevin and Kell" and "Save My Place". (Save My Place is only $0.99. You might want to download it to see if its help (info) screen is doing what you want)

    What we do is create an array of booleans "section is open" for each section of items.
    If a section is not open, we return 1 in response to the numberOfRowsInSection data source call for that section.
    (The only row is the section heading with the disclosure button.)

    If the user taps a section, we change a flag to indicate that that section is now "open," and insert the extra rows for that section into the table view using the insertRowsAtIndexPaths:withRowAnimation: method.

    I'm having a bit of a problem trying to visualize what your trying to do.

    We came up with some lazy load tableviews that might give you want you want in a little bit different ui then what you are describing.

    Lazy load facebook album cover images - Life in The Clouds
    Help us build great applications or let us make your applications exceptional. We are experts in all types of streaming find us on Facebook
Sign In or Register to comment.