First, set up the proxy and data source methods in Tableviewcontroller:
@interface Firsttableviewcontroller ()<UITableViewDataSource,UITableViewDelegate>
- implement a series of data source methods: Let them display data such as simply displaying a few lines:
#pragma the mark data source method
/**
* How many sets of data are there?
*/
-(Nsinteger) Numberofsectionsintableview: (UITableView *) TableView
{
return 2;
}
/**
* How many lines are there in section group
*/
-(Nsinteger) TableView: (UITableView *) TableView numberofrowsinsection: (nsinteger) Section
{
if (section = = 0) {
return 2;
}else{
return 4;
}
}
-(UITableViewCell *) TableView: (uitableview*) TableView Cellforrowatindexpath: (Nsindexpath *) Indexpath
{
UITableViewCell *cell = [[UITableViewCell alloc]initwithstyle:uitableviewcellstyledefault ReuseIdentifier:nil];
Cell.textLabel.text = @ "11";
return cell;
}
- Add this method to implement the jump.
-(void) TableView: (UITableView *) TableView Didselectrowatindexpath: (Nsindexpath *) Indexpath
{
Secondtableviewcontroller *svc = [[Secondtableviewcontroller alloc]init];
[Self.navigationcontroller pushviewcontroller:svc Animated:yes];
}
Note: After clicking on the cell, create a uiview and then push it with Navigationcontroller.
This will allow you to successfully create a new page by clicking on the cell and implementing the jump.
---------from Baidu experience, there are deletions, thanks to the original
Code implementation UITableView Click cell jump