IOS custom cell (cell height inconsistency) through code (optimized for performance)

Source: Internet
Author: User

Steps to create a cell

1. Create a new class that inherits from Uitabelviewcell

2. Overriding Initwithstyle:reuseidentifier: Methods

Add all the child controls that need to be displayed (you don't need to set the child control's data and frame, and the child controls are added to the Contentview)

Make child controls one-time property settings (some properties need to be set once, such as fonts \ fixed pictures)

3.2 Models available

Data model: Storing text data \ Picture data

Frame model: The height of the Frame\cell of the data model \ All child controls (optimizes performance)

4.cell has a frame model (don't have a data model directly)

5. Override the setter method of the Frame model property: Set the child control's display data and frame in this method

The initialization of the 6.FRAME model data has been done in a lazy manner (each cell corresponds to the frame model data is loaded only once)

IOS custom cell (cell height inconsistency) through code (optimized for performance)

Related Article

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.