У меня странная проблема - в моем коде я получаю данные из Интернета в формате XML и заполняю NSMutableArray (всего 34 элемента).
Эти данные должны отображаться в TableView.Я создал собственный TableViewCell для этого.Однако он всегда отображает только первые 10 элементов (0-9), затем 11-й элемент изменится, когда вы прокрутите таблицу вверх (начиная с 11 и изменив себя на 12, 13, 14 ...), а затем отобразитснова первые 10 элементов.
- (NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section {
return [myCurrencies count];
}
- (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *myIdentifier = @"CurrencyDisplayCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:myIdentifier];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"CurrencyTableViewCell" owner:self options:nil];
cell = tableViewCell;
cell.accessoryType = UITableViewCellAccessoryNone;
self.tableViewCell = nil;
}
NSLog(@"%i",indexPath.row);
actualRate.text = [NSString stringWithFormat:@"%@",[myRates objectAtIndex:indexPath.row]];
currencyCode.text = [NSString stringWithFormat:@"(%i) %@",indexPath.row,[myCurrencies objectAtIndex:indexPath.row]];
countryFlag.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@.gif",[myCurrencies objectAtIndex:indexPath.row]]];
return cell;
}
Однако, когда я просто устанавливаю текстовую метку стандартной ячейки, все в порядке, и я отображаю 34 строки таблицы с номерами 0 - 33:
cell.textLabel.text = [NSString stringWithFormat:@"%i",indexPath.row];
Есть идеи?