在tableview(iOS)中从parse.com显示数组

我正在绑定显示在我的表视图中的数组在parse.com上的数据库我可以显示数组中的第一个项目,但不是其余。

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if(cell==nil){ cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier]; } _ListArray = [object objectForKey:@"content"]; NSLog(@"OBJECT = %@",_ListArray); NSString *cellValue = [NSString stringWithFormat:@"%@", [_ListArray objectAtIndex:indexPath.row]]; cell.textLabel.text = cellValue; if(refresh <counter) { NSString *br = @"<br>"; List = [NSString stringWithFormat:@"%@%@%@", List, br, cell.textLabel.text]; NSLog(@"%@",List); refresh ++; } cell.accessoryType =UITableViewCellAccessoryDisclosureIndicator; return cell; } 

如果我尝试使用:

 -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [_ListArray count]; } 

我在桌子上什么也没得到。

编辑更新:

删除了self.ListArray并使用_ListArray。

在h文件中:

 NSMutableArray *ListArray; ... @property (retain, atomic) NSMutableArray *ListArray; 

然后在m文件中:

 @synthesize ListArray = _ListArray; 

关于:

 self.ListArray = [object objectForKey:@"content"]; 

该对象是PFObject。

我有queryForTable从哪里得到parsing的数据。

 - (PFQuery *)queryForTable { PFQuery *query = [PFQuery queryWithClassName:@"List"]; [query whereKey:@"user" equalTo:[PFUser currentUser]]; // user [query whereKey:@"objectId" equalTo:[theListID objectId]]; // the specific list counter =[query countObjects]; NSLog(@"%d",counter); // If Pull To Refresh is enabled, query against the network by default. if (self.pullToRefreshEnabled) { query.cachePolicy = kPFCachePolicyNetworkOnly; } // If no objects are loaded in memory, we look to the cache first to fill the table // and then subsequently do a query against the network. if ([self.objects count] == 0) { query.cachePolicy = kPFCachePolicyCacheThenNetwork; } [query orderByDescending:@"createdAt"]; return query; } 

而对于objectForKey:@“content”]; 内容是在我的类的parsing所以我需要说我想从什么类的对象,这是名为“内容”的数组列,

logg(当NSLog在数组上处于活动状态时)。

 Inköpslista[7856:12e03] Warning: A long-running Parse operation is being executed on the main thread. Break on warnParseOperationOnMainThread() to debug. 2013-10-21 14:23:31.008 Inköpslista[7856:12e03] 1 2013-10-21 14:23:31.017 Inköpslista[7856:12e03] OBJECT = ( "Br\U00f6d", Anka, Boll, Sko ) 2013-10-21 14:23:31.017 Inköpslista[7856:12e03] <html><body><br>Bröd 2013-10-21 14:23:31.545 Inköpslista[7856:12e03] OBJECT = ( "Br\U00f6d", Anka, Boll, Sko ) 

得到它的工作,确实把数组我得到的数据从parsing,然后只调用

 cell.textLabel.text = [_ListArray objectAtIndex:indexPath.row]; 

然后我可以使用:

 -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [_ListArray count]; }