-2

这是我的 nsarray 的日志,有两个字符串。

GROUPSFORDISPLAY (
"Serie A",
"Serie B"

这正是我想要在 tableviewcells 中显示的内容,但应用程序正在崩溃。我正在使用的代码是:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath  *)indexPath object:(PFObject *)object {
    static NSString *CellIdentifier = @"Cell";

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



    NSString *series = [_seriesForDisplay objectAtIndex:indexPath.row];
    cell.textLabel.text = series;

谢谢。

4

1 回答 1

2

它说您的数组计数为 2 并且您正在访问 3rd item 。所以请尝试使用这个。

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{
    return _seriesForDisplay.count;
}
于 2013-12-16T16:05:17.733 回答