Azin Nilchi
Azin Nilchi

Reputation: 899

how to change direction of scrolling in UIScrollView?

I have a horizontal scroll view with fixed height .my scroll view, scrolls from left to right but I want to scroll from Right To Left . how can I achieve this?!

this is how I created my Horizontal scroll View:

I've scroll view leading and trailing align to parent, and height = 50, inside my scroll view there is a view with equal height and width to its parent, but the priority of equal width is low, so it can scroll horizontally!

my scroll view Constrains

view inside the scroll view constrains

my viewcontroller in storyboard

Upvotes: 0

Views: 3140

Answers (1)

Azin Nilchi
Azin Nilchi

Reputation: 899

the answer was in this link I had to add these lines to my code in swift 4:

myScroll.transform = CGAffineTransform(rotationAngle: .pi);
subview.transform =  CGAffineTransform(rotationAngle: .pi);

Upvotes: 2

Related Questions