【问题标题】:Display multiple images in Tableviewcell在 Tableviewcell 中显示多个图像
【发布时间】:2017-05-02 18:03:26
【问题描述】:

点击前进和后退按钮时如何在单个单元格中显示多个图像,如下图所示。

【问题讨论】:

标签: ios objective-c uitableview imageview tableviewcell


【解决方案1】:

我猜你的表格数组看起来像:

[
    {
        price   : "$ 000",
        adress  : "adress",
        size    : "size",
        imagesArray : [
                    {
                        imageName : "name",
                        image  : "image"
                    }
                  ]
    }
]

在表格视图单元格中使用集合视图,并为集合视图启用分页。将图像数组传递给集合视图

如果仅在表格视图单元格中使用图像视图,则应保持图像的位置。因此,只需创建一个可变的位置数组,其中表数组计数为 3 个值,并且位置数组应为 [0,0,0]。最初,第 0 个索引将是可见的。所以给定的值为 0。

cellForIndex方法中:

NSArray * imageArray =[NSArray new];
imageArray = [[tableArray objectAtIndex:indexPath.row] valueForKey:@"imagesArray"]

NSInteger imageIndex = [positionArray objectAtIndex: indexPath.row];

cell.imageView.image = [imageArray objectAtindex:imageIndex] valueForKey:@"image"]

indexpath 设置为箭头按钮的标记。

如果您在表格视图的第一个索引中单击右箭头,在目标方法中,从标签获取索引并在位置数组的第一个索引值处增加值。现在重新加载表格视图或特定单元格。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多