Getting Started with iOS development: a simple table view

Source: Internet
Author: User

Table view is the most frequently used view in iOS development, and we generally choose to display the data in the form of a table, such as Address Book, channel list, etc.  Table View segmentation, grouping, indexing and other functions so that we show the data looks more regular and more conditioning, and more exciting is the table view can also use the details of the display of features such as multi-level display data, is called a table victory thousand words. However, compared to the other controls table view is more complex, but compared with the table view of the various flexible features, we spend on the effort is quite worthwhile.

Simple table View

Table view of the form of flexible, in line with the principle of simplicity, we first start from the simple table view to learn. The simple table view in this section is a dynamic table (all dynamic tables have no dynamic table and static table differences before IOS 5).

Create a simple table view

After iOS 5 we can use Xib or storyboard technology to create a table view, to show the most basic table, we only need to implement the Uitableviewdatasource protocol must be implemented, respectively, TableView: Numberofrowsinsection: And Tableview:cellforrowatindexpath: It's OK. :

Constructor Initwithframe:style: Called when the table view is instantiated, if the table view is designed with a xib or storyboard, the creation of the table view is done when the table view controller is instantiated, and the table view displays TableView when it is displayed: Numberofrowsinsection: The message asks for the number of rows in the current section, and the table view cell displays Tableview:cellforrowatindexpath: The message provides display data for the cell.

We create a simple table view with the default style for the cell, with the icon and the main title, which shows the World Cup team information.

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.