I have a UITableView that I am allocating multiple times during the lifetime of my app, I want the names of the rows to stay in scope. What is the most memory efficient way of doing this.
A:
UITableView is not intended to "remember" anything (if you reuse UITableViewCells properly it may not even "remember" what it displayed in a cell that just hid during scrolling) - it "asks" its DataSource what data to display in a cell for a certain index path. So you must have separate class (data source) which is responsible for "remembering" row names and providing those names for table view to display.
To persist datasource while application works you can implement it as a singleton class or make a member of some other class (e.g. your application delegate).
Vladimir
2010-02-23 14:07:57
That was what I thought I just didn't really want to do that but it does seem better for memory management somewhat...
Jaba
2010-02-23 17:06:23