首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >uicollection视图日期视图

uicollection视图日期视图
EN

Stack Overflow用户
提问于 2013-06-23 14:51:11
回答 1查看 88关注 0票数 0

我是iphone的新手。我在我的应用程序中有一个集合视图,它工作得很好,但现在我想在另一个图像视图中选择一个图像和下一个视图控制器中我想要的图像。- (NSInteger)collectionView:

我使用以下代码:

代码语言:javascript
复制
- (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;
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-06-23 15:24:37

实施collectionView:didSelectItemAtIndexPath:

代码语言:javascript
复制
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    UIImage *image = [UIImage imageNamed:[recipeImages objectAtIndex:indexPath.item]];
    // go on...
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17258374

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档