我必須在一個視圖控制器中調用兩個tableviews。我爲第一個tableview分配了標記值,我只獲取了一個tableview的數據,其他未顯示任何數據。我怎樣才能得到兩個tableviews的數據。如何在一個視圖控制器中爲tableview分配標記值
我已經指派firsttableview.tag=1
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if(tableView.tag==1){
FirstTableViewCell *cell1=[tableView dequeueReusableCellWithIdentifier:@"ProfileTableViewCell"];
if(!cell1){
cell1=[[FirstTableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"FirstTableViewCell"];
}
cell1.backgroundColor=[UIColor clearColor];
[email protected]"ios";
[email protected]"9:30AM";
//[self.secondTableView reloadData];
return cell1;
}
SecondTableViewCell *cell1=[tableView dequeueReusableCellWithIdentifier:@"SecondTableViewCell"];
if(!cell1){
cell1=[[SecondTableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"SecondTableViewCell"];
}
cell1.backgroundColor=[UIColor clearColor];
[email protected]"Hyderabad";
return cell1;
}
}
你的代碼在哪裏?請發佈'cellForRowAtIndexPath'方法的正確代碼,併發布numberOfRows方法代碼。 – CodeChanger