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.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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).