-(void) viewdidload {
[Super viewdidload];
Self.Labelarray=[[nsmutablearray alloc]< Span class= "S6" >initwithobjects:@ " personal data ,@ " My favorites " ,@ " my message " ,@ " My listings ",@" My footsteps " , @ " feedback " ,@ " About "nil
self. Picarray=[[nsmutablearray alloc]initwithobjects:@ "C11",@ "C12", @ "C13",@ "C14",@ "C15",@ "C16",@ "C17",Nil];
additional setup after loading the view, typically from a nib.
}
number of rows displayed
-(Nsinteger) TableView: (uitableview *) TableView numberofrowsinsection: (nsinteger) section{
return self. Picarray.count;
switch (section) {
case 0:
return 1;
break;
case 1:
return 4;
break;
default:
return 1;
break;
}
}
Number of sections
-(Nsinteger) Numberofsectionsintableview: (uitableview *) tableview{
return 3;
}
reuse mechanism, reuse cell
-(uitableviewcell *) TableView: (uitableview *) TableView Cellforrowatindexpath: ( Nsindexpath *) indexpath{
Tttableviewcell *cell=[tableview dequeuereusablecellwithidentifier:@ "Celltest" Forindexpath: Indexpath];
Switch (indexpath. Section) {
case 0:
Cell. imageviewt. Image=[UIImage imagenamed:self. Picarray[0]];
Cell. labelviewt. Text=self. Labelarray[0];
break;
case 1:
Cell. imageviewt. Image=[UIImage imagenamed:self. Picarray[Indexpath. Row+1]];
Cell. labelviewt. Text=self. Labelarray[Indexpath. Row+1];
break;
case 2:
Cell. imageviewt. Image=[UIImage imagenamed:self. Picarray[Indexpath. Row+5]];
Cell. labelviewt. Text=self. Labelarray[Indexpath. Row+5];
break;
default:
break;
}
return cell;
}
Click to jump
-(void) TableView: (uitableview *) TableView Didselectrowatindexpath: (nsindexpath *) indexpath{
if(Indexpath. Section= =0) {
[self performseguewithidentifier:@ "1" sender: indexpath];
}Else if(Indexpath. Section= =1) {
Switch (indexpath. Row) {
case 0:
[self performseguewithidentifier:@ "2" sender: indexpath];
break;
case 1:
[self performseguewithidentifier:@ "3" sender: indexpath];
break;
default:
break;
}
}Else
[self performseguewithidentifier:@ "7" sender: indexpath];
}
Cell Overhead Distance
-(cgfloat) TableView: (uitableview *) TableView heightforheaderinsection: (nsinteger) Section {
return ;
}
TableView the last color
-(UIView *) TableView: (UITableView *) TableView viewforfooterinsection: (Nsinteger) section{
UIView *view=[[uitableview Alloc]init];
UIView *view=[[uitableview alloc]initwithframe:cgrectmake (0, 0, 20, 100)];
View.backgroundcolor=[uicolor Lightgraycolor];
return view;
//}
-(cgfloat) TableView: (uitableview *) TableView heightforfooterinsection: (nsinteger) section{
return ;
}
PS: Custom cell to create a uitableviewcell for it, you can drag directly to the current controller in the cell to implement the method
Implementing multiple cell Layouts for Tabelview