Lan Yi Education TableView, Navigationcontroller,tableviewcontroller

Source: Internet
Author: User

I studied TableView yesterday, Navigationcontroller,tableviewcontroller.

TableView:

TableView reuse mechanism (memory saving): Specifies the kind of cell by specifying a reuse identifier (reuseidentifier) for each cell,

Allows cells to be recovered for reuse when the cell is scrolled out of the screen.

Several methods:

The following two methods in the protocol: Uitableviewdatasource, @required (required), click on command to open the protocol uitableviewdatasource.

Control how many lines there are in a part

-(Nsinteger) TableView: (UITableView *) TableView numberofrowsinsection: (Nsinteger) section{

return 65; Total number of rows in a section

Control the display of TableView this method is called every time a row is displayed

-(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (Nsindexpath *) indexpath{

}

Click on a line to execute this method to display the contents of the current line

-(void) TableView: (UITableView *) TableView Didselectrowatindexpath: (Nsindexpath *) indexpath{

}

Control the height of each row (method in Protocol delegate, add protocol Uitableviewdelegate)

-(CGFloat) TableView: (UITableView *) TableView Heightforrowatindexpath: (Nsindexpath *) indexpath{

if (indexpath.row%2==0) {

return 60; That is, the even row height is 60, and the other (odd line) height is 30

}else{//indexpath.row*30 increments by 30 per line

return 30; }


Lan Yi Education TableView, Navigationcontroller,tableviewcontroller

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.