Reputation: 11388
I have a complex view, let's say ComplexView
, that consists of 10 labels, 2 buttons, 2 large images and I need to create it many times (scrolling, fast scrolling!) - texts and images are different in any two different ComplexView
views.
Currently I am creating each ComplexView
instance programmatically.
1) I wonder if there are some techniques to speed up the process of creating uiview each time?
2) The only option I see I could experiment: is to create a xib-file for this particular view and extract a generic part of my view there - will I get a benefit from that?
UPDATE: Similar question with detailed explanation of what Seamus Campbell said here in accepted answer: How to reuse/recycle custom element like uitableviewcell does?
Upvotes: 1
Views: 271
Reputation: 17916
The best way to achieve high performance displaying complex views is to take the UITableView
approach and re-use offscreen views rather than creating new ones. The simplest way to do that is to just use a table view and custom cells, but it's also possible to roll-your-own if the table view's assumptions don't make sense.
Upvotes: 2