This method is generally used to determine the final position of the item. Modifying this method can achieve some adsorption effects. However, when encountering loop items, we usually achieve the loop effect through the delegate method of scrollView. However, through this method , because the contentOffset of the collectionView is changed, the above method cannot calculate the final location of the item. So what should we do to loop and scroll the item to the specified position? Forgive me for using a very low method
Set the number of items, - -! The reason for the reuse mechanism is so we don’t have to worry about memory and performance issues! Please give me some advice if there is a better way...
加头加尾, for example, if there are four items, the actual item should be 6, that is, 412341. When manually scrolling to the back 1, the code will immediately slide (without animation effect) to the front 1, and the reverse direction is similar.
I have to write my own answer again. Is it because I asked the question incorrectly that no one answered? All right! I'll finish it myself!
This method is generally used to determine the final position of the item. Modifying this method can achieve some adsorption effects. However, when encountering loop items, we usually achieve the loop effect through the delegate method of scrollView. However, through this method , because the contentOffset of the collectionView is changed, the above method cannot calculate the final location of the item. So what should we do to loop and scroll the item to the specified position?
Forgive me for using a very low method
Set the number of items, - -! The reason for the reuse mechanism is so we don’t have to worry about memory and performance issues! Please give me some advice if there is a better way...
加头加尾
, for example, if there are four items, the actual item should be 6, that is, 412341. When manually scrolling to the back 1, the code will immediately slide (without animation effect) to the front 1, and the reverse direction is similar.