UIScrollView performance issue due to many shortcuts

I have a pretty big UIScrollView (contentSize 8000 x 960) with a lot of small shortcuts.

Labels are only added if you go to the area to which the label belongs. So, firstly, the curl is smooth, but as more and more shortcuts load, the performance more and more.

What is the best scroll smoothing solution? Is there a CATiledLayer path? Or should labels be hidden from the view or something like that?

Many thanks for your help!

Stephen

EDIT: I got a huge performance boost when drawing some objects instead of using views; but now I have a different problem; if I draw directly on a UIScrollView, everything works fine. But if I lay a UIView on a UIScrollView and draw it, the performance will decrease again (setNeedsDisplayInRect: is called both times in scrollViewDidScroll :).

So, hierarchy:
UIWindow
UIView
UIScrollView <== the figure here

works fine.

But hierarchy:
UIWindow
UIView
UIScrollView (size 8000x960)
UIView (size 8000 x 960) <== the picture here

does not work well.

Any ideas why? I need the UIView above because the picture must be above some UIView; so I put UIViews in scrollView and draw in the view above ...

+5
source share
4 answers

Reusing labels is one possible solution. Sometimes it doesn’t help much. When a new UIView appears, the drawRect method will be called, which may cause animation problems.

( ) Core Graphics UILabel - . CALayer , , .

, = 0 = YES , . , , Core Graphics.

+1

- UILabels . - (void)scrollViewDidScroll:(UIScrollView *)scrollView . UITableView 90 , scrollview. , TableView.

+1

, , UIViews , "shouldRasterize". , , , . , UIButton, :

button.layer.shouldRasterize = YES;
0

- UITableViewCell

dequeueReusableCellWithIdentifier

reuseIdentifer .

-1
source

All Articles