Closed mengheangrat closed 7 years ago
You can control vertical margin via infiniteScrollIndicatorMargin
. Default margin is set at 11pt, along with 22pt default activity indicator this gives us around 44pt indicator row which is the same as default cell size, with custom size indicator this does not hold true anymore so you have to adjust the number for your needs.
Documentation is available at:
collectionView?.infiniteScrollIndicatorView = CustomInfiniteIndicator(frame: CGRect(x: 0, y: -70, width: 35, height: 35)) // Set custom indicator margin collectionView!.infiniteScrollIndicatorMargin = 70 // Add infinite scroll handler collectionView!.addInfiniteScroll { [weak self] (scrollView) -> Void in self?.fetchDataFresh(){ scrollView.finishInfiniteScroll() } } collectionView!.infiniteScrollTriggerOffset = 100 refreshControl.addTarget(self, action: #selector(self.refreshData), for: UIControlEvents.valueChanged) self.collectionView!.addSubview(refreshControl) Still not working
So roughly that's how it should be:
Even with refresh control in everything works as expected here testing with iOS 10.2 simulator. Please refer to demo app coming with the library. Maybe it will help you to spot the problem.
If you use custom flow layout, make sure that your layout produces the correct content size. InfiniteScroll works with contentInset only to add extra spacing to accommodate indicator view.
Also, it would be easier to understand what is going on if you provided entire screenshot. Indicator always appears below tabbar or screen boundaries. If you don't have enough content it will bump content inset to cover that to ensure that it does not appear out of nowhere. (case when content size is smaller than view bounds)
@pronebird Now It's worked.
It's error because of add infiniteScrollTriggerOffset
after addInfiniteScroll
Thank you so much.