UITableView and Cell Properties

Source: Internet
Author: User

UITableView is a common and powerful control in the iOS UI

Basic use:

1> set the agent, generally the controller is set as the agent: Self.tableView.delegate = self;

2> compliance with agent protocols and implementation methods

Protocol: Agent protocol: uitableviewdelegate; Resource agreement: Uitableviewsource

A: Resource protocol implementation method: Numberofsectionsintableview tells UITableView to display several sets of data

Numberofrowsinsection tells UITableView that each group of data has several lines

Cellforrowatindexpath tells UITableView what the contents of each line are

B: Proxy protocol: A common method

Row Height: Heightforrowatindexpath

Title of each group: heightforheaderinsection

Description of each group or call Note: heightforfooterinsection

3> display the contents of each group with the cell

=======================================================

Common Properties of Cell:

1: Set up auxiliary views: Accessorytype and Accessoryview

The difference between accessorytype is American drama type: The value is usually fixed several

Accessoryview receives a UIView control: But here the control has a default frame, like: uiswitch;

However, normal does not have a default frame, and if you do not set frame it will not be displayed

2: Set color: Background color, color when selected:

Background color: Backgroundview and BackgroundColor

Difference: Backgroundview priority is higher than backgroundcolor and will overwrite BackgroundColor's display

Second: Backgroundview can receive a control, BackgroundColor is inherited from UIView, can only receive Uicolor

Color When selected: Selectedbackgroundview

UITableView and Cell Properties

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.