If you look into Facebook "App" for iOS, scrolling of the UITableView
is very fast. It seems like the app is rendering data into cell in different thread (not in main thread).
I'm also developing a similar application. But my app scrolling speed is not good. I'm using lazy loading of images. Even then the scrolling speed is poor.
Is it possible to populate custom UITableViewCell
in different thread (not in main thread)????
Thanks for reply
Suppose You have Following Tasks Per UITableViewCell
You Should perform 1 , 2 , 3 in Background
But You have to and you should do the 4 in Main Thread.
Don't create a separate thread for each and every tableview cell and then again 3 for tasks 1 , 2 , 3. Its really wasting of resources.
So How you can do all these background without creating a thread for each and every thing.
Use GRAND CENTRAL DISPATCH (GCD)
Read on GCD.
If you want a quick workaround Here it is
Well. Task Number 4 has two things to do.
4(a) Update Some text on table cell for Date we get. 4(b) Display Fetched and Resized Image.
I'm Taking
1 and 4(a)
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
1. DO 1 Here
2. Call a Call Back When your Task is Done
example
CallBack(Response);
});
CallBack(Response *)response{
dispatch_async(dispatch_get_main_queue(), ^{
Do your 4(a) Here
});
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.