0

现在我有一个表格视图,我可以向你保证委托方法都可以工作。但我正在尝试从数组中加载表格视图。当我在应用程序中更早地登录时,相同的数组返回实际对象,但是当我尝试访问其中的相同数组时,- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 它总是返回 nil/null。这是以下实现- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

NSLog(@"cell for row at twitter called");
static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}

NSDictionary *tweet = [timeLineData objectAtIndex:indexPath.row];
// NSLog(@"Tweet at index %d is %@", [indexPath row], tweet);
//NSLog(@"Tweet: %@", tweet);
cell.textLabel.text = [tweet objectForKey:@"text"];

cell.detailTextLabel.text = [tweet valueForKeyPath:@"user.name"];


return cell;

我很困惑为什么会这样,因为在我所有其他项目中,相同的代码都可以正常工作。任何帮助将不胜感激。

谢谢,维林德博拉

4

1 回答 1

1

如果您使用以下方法访问数组会有所帮助:

[yourArray objectAtIndex:indexpath.row];
于 2012-05-18T21:23:33.750 回答