多个UITableView,一个视图,两个填充视图,一个空白视图。什么';问题是什么?
我在一个视图中有三个表视图,出于某种原因,其中两个显示数据,但一个不显示,我的问题是什么 我猜问题出在cellForRowAtIndexPath声明中。随信附上多个UITableView,一个视图,两个填充视图,一个空白视图。什么';问题是什么?,uitableview,ios7,nsmutablearray,nsarray,Uitableview,Ios7,Nsmutablearray,Nsarray,我在一个视图中有三个表视图,出于某种原因,其中两个显示数据,但一个不显示,我的问题是什么 我猜问题出在cellForRowAtIndexPath声明中。随信附上 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier=@"Cell"; UITableViewCe
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier=@"Cell";
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
if (tableView==_titleTV) {
NSDictionary *dictionaryTwo = [_titleArray objectAtIndex:indexPath.section];
NSArray *arrayTwo = [dictionaryTwo objectForKey:@"data"];
NSString *cellValueTwo = [arrayTwo objectAtIndex:indexPath.row];
cell.textLabel.text = cellValueTwo;
}
if (tableView==_cuisineTV) {
NSDictionary *dictionary = [_cuisineArray objectAtIndex:indexPath.section];
NSArray *array = [dictionary objectForKey:@"data"];
NSString *cellValue = [array objectAtIndex:indexPath.row];
cell.textLabel.text = cellValue;
}
else {
int storyIndex = [indexPath indexAtPosition: [indexPath length]-1];
cell.textLabel.text=[_favouritesArray objectAtIndex: storyIndex];
}
return cell;
}
有什么问题吗
谢谢,
SebOH.尝试打印出
cellValueTwo
的值,以确保其不是空字符串:
NSLog(@"cellValueTwo value: %@",cellValueTwo);
您是否检查以确保为
\u titleTV
创建的单元格数量与您期望从-(NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section
返回数组的单元格数量一致?!真奇怪。你认为问题可能是什么?我不太清楚你所说的“返回数组”是什么意思。你能澄清一下吗?打印cellValueTwo值时,是否看到字符串?cellValueTwo值:Bill、Bruce、Bob、Alex、All、Andrea“