UITableView: dynamically determining the number of sections

I have a medical iPhone application that I am working on, where the user creates temporary records for a series of tests performed, which are stored in sqlite for retrieval and later deployment. In my model class, I have an NSArray property populated with these entries, which is updated as new additions are added to the application.

One thing I would like to do is display a UI behavior similar to what the calendar list view does - for any given day, it displays a section header that shows the name of the day and date, and also shows the entries made for that day.

In brute-force terms, I can see how you could do this, since by creating a list of entries you can store the entire list in a dictionary entered by date.

This seems rather inelegant, so I'm wondering if there are other more efficient ways to accomplish this task.

0


a source to share


1 answer


If there is Core Data available on the iPhone, you might want to store your information that way, not sqlite.

Then, when you need data for a specific day, you can search using NSPredicate with a sort descriptor.



The master data will then return the appropriate data, sorted according to your descriptor. Nice and tidy.

Maybe visit Apple Dev Center / Forums for more information on upcoming software ...

0


a source







All Articles