Alan Quatermain

The Tumblog of one Jim Dovey, iOS Software Chief Architect at Kobo in Toronto, Ontario.
He Twitters, he has an , and can occasionally be found on LinkedIn or Facebook.
If you have a query, you can ask it here.

This blog contains personal opinions, and is not endorsed by any company.

404956809
If, for example, I was making an app that used a table view and when you tapped a cell in the table view, you would drill down to a fairly long (3-4 pages) scrollable view, how should the data be stored? Should I use just store the text in a simple UITextView or should I use a more code-based, complex system of storing the data? I will not be using anything other than text and will have many (100+) views like this. Should I re-use the same view for all the cells or make a new one in IB for each?

Thanks so much,

Joe

AskerAnonymous

So I’m guessing that you mean to push a text view containing a lot of text (or similar) each time a row is selected? In that case you could indeed re-use the text view, although I’m not certain of the relative merits of doing so. You would save the work of creating the view, but you’d not alleviate any of the burden of text rendering. If you find the application slow then look at caching the view itself, but otherwise assume it’s safe to create a new view each time you need to push one (Avoid Premature Optimisation).

In general I’d suggest to simply create a new text view (or its container via a controller/nib pair, etc) each time you want to push a new text view. The text itself would ideally be stored on disk somewhere and loaded on demand by the text view’s controller in -viewDidLoad, and could be released in -viewDidUnload.

Hopefully this answers your question— send some more details if I’ve missed any nuances about which you were concerned.