0

uitable を collectionview に変換する際に問題があります。

次のコードがありますが、「collectionView dequeueReusableCellWithIdentifier」でエラーが発生します。何が問題なのですか?

    - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
    return 1;
}

//  Return the number of rows in the section (the amount of items in our array)
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return [pictureListData count];
}

//  Create / reuse a table cell and configure it for display
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView
                  cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *CellIdentifier = @"Cell";

    UICollectionViewController *cell = [collectionView dequeueReusableCellWithIdentifier:CellIdentifier];


    // Get the core data object we need to use to populate this table cell
    Pictures *currentCell = [pictureListData objectAtIndex:indexPath.row];
4

1 に答える 1

3

メソッド名が間違っています。UICollectionViews の場合、メソッドは次のとおりです。

- (id)dequeueReusableCellWithReuseIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath*)indexPath

だから変える必要がある

UICollectionViewController *cell = [collectionView dequeueReusableCellWithIdentifier:CellIdentifier];

UICollectionViewController *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
于 2013-04-16T13:48:27.003 に答える