0

アプリを作成していて、このエラーが発生します。どのように修正するのかわかりません。ありがとうございました。

エラーは宣言されていない識別子 'collectionView' です

そして、ヘッダーファイルがインポートされています。

ヘッダ:

#import <UIKit/UIKit.h>
NSMutableData *content;

@interface AMCollectionViewController : UICollectionViewController


@property (weak, nonatomic) IBOutlet UIBarButtonItem *tagButton;

- (IBAction)tagButtonTouched:(id)sender;

@end

エラーが発生している実装

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath*)indexPath
{
    if(shareEnabled){
        //determine the selected items by using the indexPath
        NSString *selectedPhotos = [tagImages[indexPath.section] objectAtIndex:indexPath];

        //add selected image into the array
        [selectedPhotos addObject:selectedPhotos];
    }
}

どうもありがとう

同じ .m ファイルで collectionView を複数回使用しています

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{

    return 50;

}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
        static NSString *identifier =@"Cell";

        AMCollectionViewCell *cell = (AMCollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];

        int imageNumber = indexPath.row % 10;



        cell.imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"imageicon%d.jpg",imageNumber]];
        cell.selectedBackgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"imageBorder.jpg"]];


        return cell;
    }
4

1 に答える 1