-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
加载网络图片reloadCellAtIndex方法触发三次问题 #197
Comments
谢反馈,我找时间看下 |
调整的代码如下: JXPhotoBrowser.m
open override func viewDidLoad() {
super.viewDidLoad()
automaticallyAdjustsScrollViewInsets = false
hideNavigationBar(true)
browserView.photoBrowser = self
transitionAnimator.photoBrowser = self
view.backgroundColor = .clear
maskView.frame = view.bounds
browserView.frame = view.bounds
view.addSubview(maskView)
view.addSubview(browserView)
browserView.didChangedPageIndex = { [weak self] index in
guard let `self` = self else { return }
self.pageIndicator?.didChanged(pageIndex: index)
self.didChangedPageIndex(index)
}
view.setNeedsLayout()
view.layoutIfNeeded()
self.reloadData()
}
open override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
maskView.frame = view.bounds
browserView.frame = view.bounds
pageIndicator?.reloadData(numberOfItems: numberOfItems(), pageIndex: pageIndex)
} JXPhotoBrowserView.m
open override func layoutSubviews() {
super.layoutSubviews()
print("====>>>layoutSubviews...")
if scrollDirection == .horizontal {
scrollView.frame = CGRect(x: 0, y: 0, width: bounds.width + itemSpacing, height: bounds.height)
} else {
scrollView.frame = CGRect(x: 0, y: 0, width: bounds.width, height: bounds.height + itemSpacing)
}
// reloadData()
}
/// 刷新所有Cell的数据
open func reloadItems() {
visibleCells.forEach { [weak self] index, cell in
guard let `self` = self else { return }
self.reloadCellAtIndex((cell, index, self.pageIndex))
cell.setNeedsLayout()
cell.layoutIfNeeded() // 调用该方法强制更新Cell布局
}
if let cell = visibleCells[pageIndex] {
cellWillAppear(cell, pageIndex)
}
} |
不知道作者有时间修复这问题不? |
这是来自QQ邮箱的假期自动回复邮件。
您好,谢谢你联系我。我会尽快给您回复。
|
现在这个demo跑在iOS 15.5的模拟器上会出现滑动不到下一张图也无法滑动关闭, 楼主有遇到么? |
请问一下大佬,这个问题解决了吗 |
相册只要一张图片,但是加载网络图片reloadCellAtIndex方法触发三次问题。导致一张图片同时下载三次哦。怎么解决该问题呢?
屏蔽JXPhotoBrowser中viewDidLoad方法中的两行代码,就只会重复调用两次,请问这个问题怎么只控制调用一次呢?:
The text was updated successfully, but these errors were encountered: