UITableView how to deal with the occurrence of stuttering

Source: Internet
Author: User

TableView's beginupdate and endupdate are better than Reloaddata and reloadrowsatindexpaths, because BeginUpdate and EndUpdate perform an animated block, The picture is very smooth when loaded. You'll find out if you try it yourself.

Load the picture with multi-threaded, to use the cache, that is, the need to load asynchronously

Try to be as simple as possible when calculating the height of the cell, because the cell height in the TableView is loaded once

To use the reuse mechanism, it must be used, or it will be card

Users habitually fast scrolling, view and data content will quickly change, if the efficiency problem is not handled well, it is easy to have a lag phenomenon. resulting in a reduced user experience.

Data refresh

If our modle is updated. The corresponding should be reflected in the uitableview above. Simple we can reload the whole tableview. This is convenient and there is no problem with the data. The only problem is that reload the whole tableview is too inefficient. And, often we're just a handful of cell content changes. So there is no need to reload the whole tableview. But that data change to refresh the corresponding cell. This is much more efficient.

Several functions related to the specific

-(void) beginupdates;-(void) endupdates; -(void) Insertsections: (Nsindexset *) Sections withrowanimation: (uitableviewrowanimation) animation;-(void) Deletesections: (Nsindexset *) Sections withrowanimation: (uitableviewrowanimation) animation;-(void) reloadsections :(Nsindexset *) Sections withrowanimation: (uitableviewrowanimation) animation; -(void) Insertrowsatindexpaths: (Nsarray *) indexpaths withrowanimation: (uitableviewrowanimation) animation;-(void) Deleterowsatindexpaths: (Nsarray *) indexpaths withrowanimation: (uitableviewrowanimation) animation;-(void) Reloadrowsatindexpaths: (Nsarray *) indexpaths withrowanimation: (uitableviewrowanimation) animation;

  

UITableView how to deal with the occurrence of stuttering

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.