【问题标题】:Hot to get index path for existing object in collection view [closed]热门获取集合视图中现有对象的索引路径[关闭]
【发布时间】:2017-04-13 21:03:58
【问题描述】:

我得到一个包含对象的数组,并用它们填充集合视图。例如,我的集合视图中有 3 个对象。有没有办法根据对象名称接收当前的索引路径?

谢谢

【问题讨论】:

    标签: ios swift3 collectionview indexpath


    【解决方案1】:
    let indexPath = objects.index(where: {
        $0.name == "value"
    }).flatMap({
        IndexPath(row: $0, section: 0)
    })
    

    【讨论】:

    • 非常感谢,效果很好。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-04-18
    • 2021-10-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-14
    • 1970-01-01
    相关资源
    最近更新 更多