gpt4 book ai didi

ios - 无法从collectionView传递indexpath(到LightBox包中)

转载 作者:行者123 更新时间:2023-11-30 11:23:55 27 4
gpt4 key购买 nike

我安装了这个软件包https://github.com/hyperoslo/Lightbox ,但我不知道如何传递我的collectionView的索引来显示所需的图片,而不是第一个

func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let controller = LightboxController(images: imagess)
controller.pageDelegate = self as? LightboxControllerPageDelegate
controller.dismissalDelegate = self as? LightboxControllerDismissalDelegate
controller.dynamicBackground = true
present(controller, animated: true, completion: nil)
}

在这种情况下,我可以更改图片,但第一个总是出现

我似乎已经阅读了所有内容,但没有找到这个重要的细节。

如果我喜欢这样:

let controller = LightboxController(images: [imagess[indexPath.row]])

我只能查看一张具有所需索引的图片,但无法更改图库中的图片

请帮忙:-)

最佳答案

您必须设置开始索引才能查看当前图像;

所以试试这个;

let controller = LightboxController(images: imagess, startIndex:indexPath.row)

关于ios - 无法从collectionView传递indexpath(到LightBox包中),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50967811/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com