UICollectionView如何从Parse查询

时间:2015-05-12 21:12:45

标签: ios parsing uicollectionview

我有UICollectionView,我需要将图像下载到UIImage单元格。我怎么能用Parse做到这一点?事实是我需要Parse类下载所有图像。

这是我的源代码示例:

- (void)runQuery {
PFQuery *query = [PFQuery queryWithClassName:@"SwapPost"];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
    // You obviously need better error handling in here...
    self.myImage = objects;
    [self.myCollectionView reloadData];
}
 ];

}

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
    // This is an assumption
    return 1;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return self.myImage.count;
}

0 个答案:

没有答案