Frame calculations

This commit is contained in:
Shial 2018-02-25 18:34:12 +11:00
parent 974425b72d
commit 709d6ddba7
1 changed files with 4 additions and 4 deletions

View File

@ -95,11 +95,11 @@ open class ListView: UIView, UIGestureRecognizerDelegate {
super.layoutSubviews()
if shouldReloadData {
panGestureRecognizer.isEnabled = isScrollEnabled && itemsCount > 1
let size = self.bounds.size
itemSize = CGSize(width: size.width - (marginForItem.left + marginForItem.right), height: size.height - (marginForItem.top + marginForItem.bottom))
populateVisibleItems()
delegate?.listView(self, didChangeDisplayItemAt: current?.itemIndex ?? 0, with: scrollOffset)
}
let size = self.bounds.size
itemSize = CGSize(width: size.width - (marginForItem.left + marginForItem.right), height: size.height - (marginForItem.top + marginForItem.bottom))
populateVisibleItems()
delegate?.listView(self, didChangeDisplayItemAt: current?.itemIndex ?? 0, with: scrollOffset)
shouldReloadData = false
}