Question

This is the log of my nsarray with two strings.

GROUPSFORDISPLAY (
"Serie A",
"Serie B"

And this is exactly what I want do show in tableviewcells, but app is crashing instead. The code I'm using is:

- (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;

Thanks.

Était-ce utile?

La solution

It says your array's count is 2 and you're accessing 3rd item . So please try to use this one.

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{
    return _seriesForDisplay.count;
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top