попробовать это ..... используется два UITableView в одном UIViewController ...
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (tableView==self.tableview1)
{
return tableview1RowCount;
}
else if(tableView==self.tableview2)
{
return tableview2RowCount;
}
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (tableView==self.tableview1)
{
static NSString *CellIdentifier1 = @"tableview1_cell";
tableview1_cell *cell1 = (tableview1_cell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier1];
if (cell1 == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"tableview1_cell" owner:self options:nil];
cell1 = [nib objectAtIndex:0];
}
return cell1;
}
if (tableView==self.tableview2)
{
static NSString *CellIdentifier1 = @"tableview2_cell";
tableview2_cell *cell2 = (tableview2_cell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier1];
if (cell2 == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"tableview2_cell" owner:self options:nil];
cell2 = [nib objectAtIndex:0];
}
return cell2;
}
}
и для метода
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
сделать то же самое, что и выше .... отдельные tableviews с, если состояние и дать действия каждому ... независимо от того, хотите ли вы ...
Я бы рекомендовал использовать тот же tableview, просто загрузите в него разные ячейки. –
Или, если вам действительно нужно два TableView, тогда используйте два UITableView в одном UIViewController – jpulikkottil
, вы можете сравнить tableview в источнике данных и делегировать методы по имени или тегу, с помощью этого вы можете загрузить нужные данные в желаемый вид таблицы. –