UI Nineth speaking. UITableView table View creation, table view reuse mechanism, table view related configuration method

Source: Internet
Author: User

I. UITableView table View creation

1> Basic properties:UITableView inherits from Uiscrollview, so you can scroll
Every piece of data in the table view is displayed in the UITableViewCell object
Table views can be partitioned to display data, each partition is called a section, each row is called row, and the number is from 0

2> Important usage:

The most important is two agent methods <UITableViewDelegate,UITableViewDataSource> (which must be achieved by Numberofrows, Cellforrowatindexpath)

section represents a partition, row: Represents a row within a partition, and the cell represents the contents of a row

Datesource Proxy method

Proxy methods for delegate

Example code:

Create a standard six-step UITableView

Steps to create a VIEWCONTROLLER.M file

Two. Reuse mechanism for table views

UITableView relies on mutableset to implement reuse functions

      cell will be added to Mutableset, enter the screen cell first from set gets, if not obtained, creates a cell. In cell before showing Span style= "FONT-WEIGHT:300; Color: #ff2600; " >cell fu the appropriate content.

Cell reuseidentifier is the key to reuse. (Use a finite cell to recycle, which is reuse)

The following is the embodiment of the cell reuse mechanism: (It is important to make a judgment, first from the reuse pool, if not obtained, create a cell)

Three. Related configuration methods for table views

1>: Setting the contents or picture of a cell

2>: Sets the height of the cell, the partition, and the height of the head foot

3> Returns the Kinsoku view, and the row's Click Trigger Event

UI Nineth speaking. UITableView table View creation, table view reuse mechanism, table view related configuration method

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.