Steps to customize the cell (the height of each cell is different, and the contents of each cell are different)

Source: Internet
Author: User

1. Create a new subclass that inherits from UITableViewCell  

2. Initialization of child controls in Initwithstyle: Method

1> all child controls that are likely to be displayed are added to the Contentview

2> set some properties of the child controls (one-time settings: font, text color, background

3.2 Models available

1> One is the data model (text data + picture data)

2> One is a frame model (data Model + height of frame + cell for all child controls)

4. Cell should provide a Frame model property

1> passing the frame model to the cell

2> cell sets the frame to the child control according to the frame model, sets the data to the child control according to the data model

3> cell determines which child controls are displayed and hidden based on the data model

5. The proxy method in TableView returns the height of the cell

Steps to customize the cell (the height of each cell is different, and the contents of each cell are different)

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.