AppStoreStyleHorizontalScrollView
AppStoreStyleHorizontalScrollView copied to clipboard
convert direction to RTL instead of LTR
Hi, thanks for great plugin, How can convert the direction from LTR to RTL ?
It is an interesting question, I never thought about it before because it is not much people use it this way. This control doesn't support that, however, it is simple too achieve it. All you need is just change one place.
In scrollViewWillEndDragging function, it determine where to stop the scrolling, so you just change the target position in this function to the place you want. Here could be a example, but you might need to adjust a little bit yourself to meet your needs.
open func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
let targetOffset:CGPoint = targetContentOffset.pointee;
//move to closest item
if (targetOffset.x + scrollView.frame.size.width < scrollView.contentSize.width) {
let closestItemMinX = self.getClosestItemByX(position:targetOffset.x, inScrollView:(scrollView as! ASHorizontalScrollView))
targetContentOffset.pointee.x = closestItemMinX + (self.uniformItemSize.width - self.miniAppearPxOfLastItem)
}
}
thanks terenceLuffy for fast reply,
but that did't change the direction.
I installed your sampleScorllViewInSwift and changed the method (scrollViewWillEndDragging) which you modify it , and it still start objects from left not from the right , and noticed that when finish dragging the objects move to right little bit, and not this what i want.
regards
I missed you last comment, would you explain your requirement with more details?