Я отправляю данные в коллекцию, но я получаю сообщение об ошибке [__NSCFConstantString objectAtIndex:]: unrecognized selector sent to instance.
Пожалуйста, помогите мне. Спасибо.CollectionView данные не отображаются
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
// NSURL *imageURL = [NSURL URLWithString:str1];
// NSData *imageData = [NSData dataWithContentsOfURL:imageURL];
// UIImage *image = [UIImage imageWithData:imageData];
// thumbnailImgView.image = image;
static NSString *identifier = @"Cell";
CustomCell *cell = (CustomCell *)[collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
UIImageView *recipeImageView = (UIImageView *)[cell viewWithTag:100];
recipeImageView.image = [UIImage imageNamed:[recipeImages[indexPath.section] objectAtIndex:indexPath.row]];
cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"img.png"]];
cell.selectedBackgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"One-Album.png"]];
return cell;
}
Можете ли вы показать мне код, в котором вы заполняете 'recipeImages'? – avismara
- (void) viewDidLoad { [super viewDidLoad]; recipeImages = [NSArray arrayWithObjects: @ "img.png", @ "One-Album.png", @ "Create-Album.png", @ "AllPhotos.png", @ "Albums.png", @ "яркость1 .png ", @" original1 (1) .png ", @" crop1.png ", ноль]; // Выполняйте любую дополнительную настройку после загрузки представления. } – Chenna
- (NSInteger) numberOfSectionsInCollectionView: (UICollectionView *) collectionView { return 1; } - (NSInteger) collectionView: (UICollectionView *) коллекцияView numberOfItemsInSection: (NSInteger) раздел { return [recipeImages count]; } – Chenna