我有3个表格视图的视图。每个表格视图将使用一个“自定义单元视图”。我使用下面的代码。但它只显示一个表格视图。有人能指出我为什么吗? (所有阵列都充满必要的物体)iPhone - 3自定义单元格的UITableViews
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString* cellID = @"CustomSyncCell";
CustomCellView* cell = (CustomCellView*)[tableView dequeueReusableCellWithIdentifier:cellID];
if(cell == nil)
{
NSArray* nibObjects = [[NSBundle mainBundle] loadNibNamed:@"CustomCellView" owner:nil options:nil];
for(id currentObject in nibObjects)
{
if([currentObject isKindOfClass:[CustomCellView class]])
{
cell = (CustomCellView*)currentObject;
}
}
}
ObjectDetails* obj;
if(tableView == phoneNumbersTable)
{
obj = [phoneNumbersArray objectAtIndex:indexPath.row];
}
else if(tableView == mailIDsTable)
{
obj = [mailIDsArray objectAtIndex:indexPath.row];
}
else if(tableView == socialUpdatesTable)
{
obj = [socialUpdatesArray objectAtIndex:indexPath.row];
}
cell.keyLabel.text = [self returnPhoneType:obj.objKey];
cell.valueLabel.text = obj.objValue;
return cell;}
是否所有三个一次可见?是否为所有三个表视图设置了委托和数据源? numberOfSectionsInTableView和numberOfRowsInSection方法是什么样子的? – Anna 2011-01-11 15:52:25
是的,所有这三个都是可见的。为所有的tableviews设置委托和数据源。表视图中的节数是1,行数是数组数。 – Satyam 2011-01-11 16:42:11