We’ve got the following problem. We need to display ScrollView content, consisting of a large amount of small objects (guitar tablature and notes) like shown on this screenshot http://www.iphones.ru/forum/index.php?app=core&module=attach§ion=attach&attach_rel_module=post&attach_id=38991. The content itself can be considerably big (contentSize.width>60000), with the corresponding number of objects. The screen can theoretically fit up to one hundred of objects, with the objects being pretty small (notes, figures).
We tried to do it with all the available objects – UIImageView, UILabel. If we try to place them all simultaniously at scrollView, the app gets terribly slow and crashes with lack of memory. If we add them upon necessity and remove, when they are invisible, then there is only the problem with slow performance.
Decided to look at how it is solved in some top apps with a similar functionality – got source code of the .h files of TabToolkit (on the screenshot) using class-dump-z.
They use methods of these types:
- (void)drawSignatureNumber:(unsigned char)arg1 inContext:(struct CGContext *)arg2;
- (void)drawMeasureNumber:(struct CGContext *)arg1;
- (void)drawRepeatNumber:(struct CGContext *)arg1;
Turns out, that we should look toward Quartz2d and Core Graphics? Or is there any other solution to the problem?
Whilst I’m somewhat reluctant to help you out since you’ve openly admitted trying to lift another developers source code from their competing product, I do recommend you take a look at CATiledLayer as it will allow you to draw huge areas on screen with little performance degradation.