UITableView indexPath пустая проблема - PullRequest
0 голосов
/ 13 ноября 2011

У меня есть эта проблема с моим UITableView.Когда я перетаскиваю таблицу так, чтобы нижний ряд был на полпути вверх, я получал сбой.Когда я в основном перетаскиваю нижний ряд как можно выше.Фрагмент кода ниже:

- (UITableViewCell *)tableView:(UITableView *)tableView 
         cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

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


    NSString *section = [[browseCategoriesDictionary allKeys] objectAtIndex:indexPath.section];
    NSArray *objectsForSection = [browseCategoriesDictionary objectForKey:section];

    NSString *cellValue = [objectsForSection objectAtIndex:indexPath.row];
    cell.textLabel.text = cellValue;
    cell.backgroundColor = [UIColor colorWithRed:0x7C/255.0 green:0x7E/255.0 blue:0xBB/255.0 alpha:1];
    cell.detailTextLabel.numberOfLines = 3;
    cell.detailTextLabel.textColor = [UIColor whiteColor];


    cell.detailTextLabel.text = [cellDescriptions objectAtIndex:indexPath.row];
    cell.imageView.image = [UIImage imageNamed:[cellIcons objectAtIndex:indexPath.row]];

    return cell;
}

Спасибо, ребята

1 Ответ

0 голосов
/ 12 октября 2012

Убедитесь, что разные источники данных, которые вы используете, не возвращают нулевые значения, это может привести к сбою.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...