I have an app that has many instances of the same UIView. Is their a way to reuse a UIView like you can with UITableViewCell? Similar to:
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
I suggest you watch session 104 of WWDC'2010 called "Designing Apps with ScrollViews" that explains the reuse mechanism (IIRC).
You can also look at the source of OHGridView in which I implemented this technique: look at the 2nd layoutSubviews method in OHGridView.m where I add unused UIViews in an NSMutableSet I called recyclePool, and then dequeue some UIViews from this recyclePool when I need one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With