AppStoreStyleHorizontalScrollView icon indicating copy to clipboard operation
AppStoreStyleHorizontalScrollView copied to clipboard

convert direction to RTL instead of LTR

Open aqeelhashem opened this issue 8 years ago • 3 comments

Hi, thanks for great plugin, How can convert the direction from LTR to RTL ?

aqeelhashem avatar Sep 24 '16 14:09 aqeelhashem

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)
        }
    }

terenceLuffy avatar Sep 24 '16 16:09 terenceLuffy

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

aqeelhashem avatar Sep 24 '16 16:09 aqeelhashem

I missed you last comment, would you explain your requirement with more details?

terenceLuffy avatar Oct 05 '16 01:10 terenceLuffy