First of all, while I have an understanding of some of the basics, I'm am still somewhat of a newbie.
I have a sectioned UITableView that I am currently using NSDictionary(for grouping) and 4 or 5 different NSArrays (for data, some of which gets passed to the next view when a cell is selected) to populate the table. It works but it's a very long list and after a few minutes of scrolling the UITableView up and down, leaving that view and coming back to it, the app starts to "slow down" and eventually freezes. I have been doing some research and have found that the way I am doing that is not the best way. I have read about using another object to populate the table which will only load data as needed and won't keep that data in memory(which is probably causing my app to freeze).
Can anyone help point me in the right direction to build a "data object" to store my data and then use it in my UITableVIew? Can I just take my NSDictionaries and NSArrays and somehow put them in thier own class and call that class? Would I use Core Data? Any other suggestions? As a note, this data cannot be added to, updated, or deleted by the user. The only time I will change the data is to add more data(a completely new record) to make the list longer and maybe once in a while, but very rarely, updated or deleted by me.
Any help would be greatly appreciated.
iphone-sdk, sharing data between multiple views
1:Some beginner Objective-C/iPhone questions
- Do you know how to use Instruments? If so, check for memory leaks.
- Do you receive
didReceiveMemoryWarningin your UITableViewController? I'm guessing so. But you want to be sure it's not any thread blocking issue.
- Are you using images in your UITableViewCells? If you have thousands of images, you definitely want to use an NSCache to store it. That will automatically clear up memory when needed.
- Are you using custom UITableViewCells? Since you are experiencing slowdown from scrolling, check this the custom cell isn't having problems drawing.
- Make sure you are dequeueing cells. This is done in template UITableViewController code, although you may have removed it for any reason.