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