Ios-uitableview Primer (1)

Source: Internet
Author: User

UITableView analogy to android 's ListView, which refers to a list of different data with the same view . For example, a list of contact persons

1.uitableviewdelegate,uitableviewdatasource is a proxy for uitableview data and Behavior, respectively .

i.e. His data is loaded by < Uitableviewdatasource> <UITABLEVIEWDELEGATE>

The 2.UITableView list is divided into two forms , one in plain ( single table ) , One is the group ( list Group ) form .

Group Plain

When a list is a single group , returns The number of >1 when the list is set to 1

-(Nsinteger) Numberofsectionsintableview: (UITableView *) TableView;

Judging by the number of groups returned by section. Returns the number of columns per group


-(Nsinteger) TableView: (uitableview*) TableView numberofrowsinsection: (nsinteger) Section;

Here are a few terms to explain

Section : number of groups or columns

Indexpath:indexpath.row Indicates the number of columns in a group

indexpath.section represents the number of groups

3. How do I display the list??have doneAndroid-listviewof all know,of the listAdapterThe view cache is implemented inside,aItemonly created for the first time,future work is just a duplicate assignment.in theiOSin,returned by eachItemto beUITableViewCelland its sub-class

-(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (Nsindexpath *) Indexpath;



Therefore, the style of each column by the group number of columns can be initially displayed as the entire list of samples.


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.