0
votes

in an iOS app I have to display a list of text items that are stored as strings in an array. Since the lines of text would be formatted differently (size, color), I tried two different approaches:

  1. create an UIWebView, make a htmlstring at runtime from the strings in the array and format it with a loaded css file

  2. create an UIScrollView, and create an UILabel for every string AND add an UIImageView with an image of a dotted line after each label (which I do with css in the approach above)

I expected very poor performance from the second approach. BUT it seems the scrollview with the labels (ca. 100) an images scrolls smoother and is more responsive than the webview.

How could that be? I do nothing in the background, just display this view. Thanks a lot!

1

1 Answers

0
votes

If I'm not mistaken it's because UIWebView doesn't pre-render anything.

Meaning - UIScrollView caches all your data for smooth transition while UIWebView renders it as it enter the view.