Should I run the delegate from the UIScrollView on a different thread to prevent performance issues while scrolling?

While scrolling, I'm going to do some tricky things in the delegate methods. I will also do dynamic preloading of the content so that in theory it is possible to scroll through several thousand images. But I'm afraid that every time I do a preload for the next big chunk in the direction of the scroll, the delegate will wait for the data source to deliver the data, and the entire scroll view will be frozen for that moment.

The problem is that I always need access to the scroll subzones. I'm new to the platform and I don't know if I still have access when I open another thread for these preboot actions? Or did the scrolling not wait for the delegate to do everything?

I'm in the planing phase, so I haven't implemented many planes.

+1


a source to share


2 answers


You can only use UI classes from the main thread. So what you need to do is compute as much as possible on the background thread (I believe you can also load images on the background thread) and then use performSelectorOnMainThread:withObject:waitUntilDone:

to manage the UI classes on the main thread.



See How do I update the UI in the middle of this thread? for another instance of your question

+3


a source


I don't have a specific answer to your specific question. I just want to make sure you are aware of the ~ 25MB RAM limit for your application. I cannot link to this because although Apple knows the limit, they don't say.



+1


a source







All Articles