Considerations for IOS Recycling

Source: Internet
Author: User

1.UI control comes with recycling

Uitableview,uicollectionview, itself with recycling, find cells in the cache pool through identifiers

Note: When you pass model data to the cell, you need to cover it all, if it's just a cell. Text1 = DataText1, then the image and Text2 of the newly displayed cell will display the old data

2. Recycling on the Uiscrollview

Ideas:

A. Get the number of data to be displayed count1, get the number of controls currently initialized Count2 (assuming UIView, and need to have 1 numbers assembled UIView, the array with lazy loading method, Count2 is actually the number of array elements)

B. Set a null pointer to the control: UIView *a = Nil

C. Traversing Count1

if (I <= count2) assigns a value directly to the control

else i > Count2, instantiate a new control, assign a value to the new control, and add the new control to the array

D. Overwrite data and handle data redundancy

E. For controls that have already been instantiated, whether they are recycled or hidden during the recycling process

Depending on the frequency of instantiation, if the frequency of instantiation is very high, it is recommended to use hidden; If the frequency is not high, the recovery

Considerations for IOS Recycling

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.