2015-05-12 22 views
0

我有UICollectionView,我需要下載圖像到UIImage單元格。我怎樣才能用Parse來做到這一點?事實是,我需要Parse類下載所有圖像。UICollectionView如何從解析查詢

這是我的源代碼示例:

- (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

問題固定與此代碼:

(NSInteger的)numberOfSectionsInCollectionView:

(UICollectionView *)collectionView { 
     // This is an assumption 
     return [receivedObject count]; 
    } 

(NSInteger的)的CollectionView:

(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { 
     self.imageCell.image = [NSArrayName objectAtIndex:indexPath.row]; 
    }