Dynamic Sections UITableView with Unknown cells
Hey, I'm basically trying to retrieve data from SQlite db and populate a tableView from it.
The sql-data-retrieval method creates two arrays. "dataArray" and "SectionArray".
DataArray is filled with data NSObjects.
Uptil this point, i can create the appropriate Section headers.
Here is the problem,
-1 What do i do to make sure that the right objects get into their appropriate sections and not under any other sections (which they seem to be doing). Also the Count(number of rows) in each section differs.
What should the code be in "NumberOfRowsAtIndexPath" and cellForRowAtIndexPath methods
-2 What kind of datasource objects are more suited for this type. I'm simply filling up two NSMutableArrays - dataArray(rows) and SectionArray(Section 开发者_开发百科headers).
I think you should make many NSArray
one for each table header you have created. In NumberOfRowsAtIndexPath
you will return the count of the array for the requested section, and in cellForRowAtIndexPath
you will choose your array using the section index (as before) and with the row index you will select the row of that array.
精彩评论