我是iphone的新手。我在我的应用程序中有一个集合视图,它工作得很好,但现在我想在另一个图像视图中选择一个图像和下一个视图控制器中我想要的图像。- (NSInteger)collectionView:
我使用以下代码:
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return recipeImages.count;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
static NSString *identifier = @"Cell";
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
UIImageView *recipeImageView = (UIImageView *)[cell viewWithTag:100];
recipeImageView.image = [UIImage imageNamed:[recipeImages objectAtIndex:indexPath.row]];
return cell;
}发布于 2013-06-23 15:24:37
实施collectionView:didSelectItemAtIndexPath:
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
UIImage *image = [UIImage imageNamed:[recipeImages objectAtIndex:indexPath.item]];
// go on...
}https://stackoverflow.com/questions/17258374
复制相似问题