We can have two table views in one NIB.
par exemple: vous avez 2 vues de table comme
UITableView *tableView1;
UITableView *tableView2;
vous pouvez utiliser ci-dessous le code de l'échantillon;
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView{
if(tableView == tableView1)
return 1;
else if(tableView == tableView2)
return 2;
}
-(NSString *) tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
if(tableView == tableView1)
return @"Table View 1";
else if(tableView == tableView2){
if(section == 1)
return @"section 1 in table view 2";
else
return @"section 2 in table view 2";
}
}
-(NSInteger) tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section{
if(tableView == tableView1)
return 5;
else if(tableView == tableView2){
if(section == 0)
return 3;
else
return 4;
}
}
-(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
if(tableView == tableView1){
.........
}
else if(tableView == tableView2){
.........
}
}