您可以使用兩個表,一個在左側,另一個在右側: tableview1.tag = 0; tableview.tag = 2;
只需重新裝入標籤= 2表視圖,而在任何行點擊左側表
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (tableView.tag == 1)
return 5;
else if (tableView.tag == 2)
return 10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *identifier = @"CellIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier] autorelease];
}
if (tableView.tag == 1)
{
///// Do whatever you want to do
}
else if (tableView.tag == 2)
{
///// Do whatever you want to do
}
cell.textLabel.text = @"example";
return cell;
}