我是Objective-C的初学者,我无法弄清楚在我的应用程序中实现它。 我设法加载行(4列)从数组解析和显示在表视图。但我无法加载所有3k行。我知道1000的限制。请指导我如何在1000次读取后每次放置指针。从解析数组中的25k行加载并在表格视图中显示
self.parseClassName = @"LocalitatiMari";
- (PFQuery *)queryForTable
{
PFQuery *query = [PFQuery queryWithClassName:self.parseClassName];
return query;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object
{
static NSString *simpleTableIdentifier = @"ROviDRGCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
// Configure the cell
//PFFile *thumbnail = [object objectForKey:@"imageFile"];
//PFImageView *thumbnailImageView = (PFImageView*)[cell viewWithTag:100];
//thumbnailImageView.image = [UIImage imageNamed:@"placeholder.jpg"];
//thumbnailImageView.file = thumbnail;
//[thumbnailImageView loadInBackground];
if (self.tableView.tag !=100)
{
UILabel *nameLabel = (UILabel*) [cell viewWithTag:101];
nameLabel.text = [object objectForKey:@"CodPostal"];
UILabel *prepTimeLabel = (UILabel*) [cell viewWithTag:102];
prepTimeLabel.text = [object objectForKey:@"Oras"];
UILabel *codnumenou = (UILabel*) [cell viewWithTag:103];
codnumenou.text = [object objectForKey:@"Judet"];
UILabel *strada = (UILabel*) [cell viewWithTag:105];
strada.text = [object objectForKey:@"Strada"];
}
else
{
PFObject *objects = [self.searchResults objectAtIndex:indexPath.row];
UILabel *nameLabel = (UILabel*) [cell viewWithTag:101];
nameLabel.text = [objects objectForKey:@"CodPostal"];
UILabel *prepTimeLabel = (UILabel*) [cell viewWithTag:102];
prepTimeLabel.text = [objects objectForKey:@"Oras"];
UILabel *codnumenou = (UILabel*) [cell viewWithTag:103];
codnumenou.text = [objects objectForKey:@"Judet"];
UILabel *strada = (UILabel*) [cell viewWithTag:105];
strada.text = [objects objectForKey:@"Strada"];
}
return cell;
}
- (void) objectsDidLoad:(NSError *)error
{
[super objectsDidLoad:error];
NSLog(@"error: %@", [error localizedDescription]);
}
你*永远不会*想下载25K对象。该应用程序应该只下载可以显示的对象,然后当用户滚动它时会执行增量下载以持续显示视图中的项目。你可以尝试批量大小,但我猜30个项目是一个很好的起点。 – Moonwalkr