JiongXing / PhotoBrowser

Elegant photo browser in Swift. 图片与视频浏览器。
MIT License
1.32k stars 209 forks source link

左右滑动的时候图片没有更新v3.0.9 #181

Closed SingletonH closed 4 years ago

SingletonH commented 4 years ago

`collectionView.deselectItem(at: indexPath, animated: false) let browser = JXPhotoBrowser()

    browser.numberOfItems = {
        self.dataSource.count
    }
    browser.reloadCellAtIndex = { context in
        let url = URL(string: self.dataSource[indexPath.row])
        let browserCell = context.cell as? JXPhotoBrowserImageCell
        // 用Kingfisher加载
        browserCell?.imageView.kf.setImage(with: url, placeholder: UIImage(named: "icon_placeholder_1"), options: [], progressBlock: nil, completionHandler: { (image, error, cashType, url) in
            browserCell?.setNeedsLayout()
        })
    }
    browser.transitionAnimator = JXPhotoBrowserZoomAnimator(previousView: { index -> UIView? in
        let path = IndexPath(item: index, section: indexPath.section)
        let cell = collectionView.cellForItem(at: path) as? MAImageBrowserCollectionViewCell
        return cell?.imageView
    })
    browser.pageIndex = indexPath.item
    browser.show()`
JiongXing commented 4 years ago

感谢反馈,我查下。楼主可以在我demo中复现出这个问题吗?

SingletonH commented 4 years ago

demo没有这个问题,我上面那段代码貌似也没啥问题

JiongXing commented 4 years ago

这么奇怪

SingletonH commented 4 years ago

let url = URL(string: self.dataSource[indexPath.row]) 数据源这里写错了,我的问题