В настоящее время я пытаюсь заполнить UITableView из списка, загруженного из Интернета. Plist загружается в NSMutableArray, а затем сохраняется в виде файла, который отлично работает.
Когда я пытаюсь заполнить мой UITableView, у меня возникают проблемы.
UITableView отображает только первые 8 записей из файла * plist (но их 98), а затем проходит по ним до тех пор, пока не достигнет 98, поэтому всегда одни и те же 8 записей вместо 98 разных.
Вот мой журнал:
2010-07-20 15:50:19.064 myCustomers[15221:207] New Cell
2010-07-20 15:50:19.065 myCustomers[15221:207] Bob
2010-07-20 15:50:19.068 myCustomers[15221:207] New Cell
2010-07-20 15:50:19.069 myCustomers[15221:207] Jo
2010-07-20 15:50:19.071 myCustomers[15221:207] New Cell
2010-07-20 15:50:19.071 myCustomers[15221:207] Neil
2010-07-20 15:50:19.075 myCustomers[15221:207] New Cell
2010-07-20 15:50:19.075 myCustomers[15221:207] Robert
2010-07-20 15:50:19.077 myCustomers[15221:207] New Cell
2010-07-20 15:50:19.078 myCustomers[15221:207] Jack
2010-07-20 15:50:19.079 myCustomers[15221:207] New Cell
2010-07-20 15:50:19.080 myCustomers[15221:207] John
2010-07-20 15:50:19.081 myCustomers[15221:207] New Cell
2010-07-20 15:50:19.082 myCustomers[15221:207] Ralph
2010-07-20 15:50:19.083 myCustomers[15221:207] New Cell
2010-07-20 15:50:19.084 myCustomers[15221:207] Bart
Создает новые ячейки, но затем останавливается на 8 и зацикливается. : /
Вот как я создаю ячейку и получаю данные массива:
if (tableView == myTable)
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
if (indexPath.section == 0)
{
cell.textLabel.text = [self.dataForTable objectAtIndex:indexPath.row];
NSLog(@"New Cell");
NSLog(@"%@",[self.dataForTable objectAtIndex:indexPath.row]);
}
}
return cell;
}
NSMutableArray "dataForTable" создается так:
if ([[[NSMutableArray alloc] initWithContentsOfFile:fullFileName] autorelease] != nil)
{
self.dataForTable = [[[NSMutableArray alloc] initWithContentsOfFile:fullFileName] autorelease];
}
else
{
self.dataForTable = [[NSMutableArray alloc] init]; //create a brand new array if there is no entries file.
}
Данные массива в порядке, я проверил это в журнале, и там показаны все 98 записей, но в табличном представлении будет использоваться только 8.
Мне не удалось найти решение для этого, кто-нибудь может мне помочь?
Спасибо!