I have a UIViewController
that does a lot of data processing up front in order to render a UIScrollView
. The bizarre thing is, even once all the processing/rendering is done, the UIScrollView
is very laggy when scrolling.
I've double checked that nothing is being processed, and I'm not even using the scrollViewDidScroll
delegate method.
I also have a UITableView
in the view (currently with no data) that is also laggy, so it's affecting everything in that view. (If I change tabs, none of the other views show any lag).
Could high memory usage cause this lag? It seems strange considering I remove most of the loaded data after processing. What else could it be?
Edit: To clarify, my UITableView
is empty at the moment, so it's not a recycling issue. I just mentioned the UITableView
because it's not just the UIScrollView
that is lagging.
Edit 2: As @MacKentoch pointed out, using rounding can cause lag. I removed the rounding from my subviews and it fixed the issue. I was using this to round the squares to circles:
label.layer.cornerRadius = height / 2
label.layer.masksToBounds = true
Is there a more efficient way to do this?