How IOS solves UITableView refresh lag

Source: Internet
Author: User

Summarize the previous project:

The thing is, I need to finish the news app show in the custom cell

While saying Sdwebimage provides a way to load images asynchronously onto Uiimageview

But there are times. Required images are not required to be covered with Uiimageview

So abandoned, and later think it is quite two force. I can do this with a layer of border uiimageview underneath.

So, pretending to be tall, I have to write on my own.

Later look at other people's methods, find some feeling, or write out, but still built in the network good situation

Solutions

Mainly to do a few things:

1. In addition to the UI section, all loading operations are done in the background. This can be achieved by dispatch or Performselectorinbackground or nsoperationqueue. See: Multithreaded Programming with GCD in iOS development using Nsoperationqueue for multi-threaded operations in IOS development

2. Avoid background loading after you have completed multiple resources, the processing time to occupy the UI thread is too long. This can be accomplished through nsoperationqueue, where the presentation of the resource to the UI is executed one at a queue, and a forced wait after each operation is completed, which can be resolved with usleep (int microseconds).

3. Reuse the cell. Creating a cell is generally slow, must be reused, and even for performance, you can create enough cells to reuse the queue at the beginning of view creation.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.