Shymaa Othman
Shymaa Othman

Reputation: 239

Scrollview with paging enabled scrolling from left to right - iOS

I have read the apple documentation concerning UIScrollView but cannot reach to a clear idea about setting the scrollview with paging enabled scrolling direction starts from Left to RIGHT to suite ARABIC content ... any ideas please ??

Upvotes: 0

Views: 2063

Answers (2)

Shymaa Othman
Shymaa Othman

Reputation: 239

I solved the problem by using UISlider by setting the slider to the last page of my scrollview in viewdidload

CGPoint pnt = CGPointMake(19 * self.scrollView.frame.size.width , 0) ;
    [self.scrollView setContentOffset:pnt animated:YES];

    CGFloat pageWidth = self.scrollView.frame.size.width;
    NSInteger page = (NSInteger)floor((self.scrollView.contentOffset.x * 2.0f + pageWidth) / (pageWidth * 2.0f));
    [slider setValue:page];

Now I can scroll by tap and scroll the appropriate direction for arabic content :)

note : 19 is the number of pages in scrollview which equals to no of images - 1 .

Upvotes: 0

Cyrille
Cyrille

Reputation: 25144

What if you just change the contentOffset to display the rightmost page on startup?

Upvotes: 1

Related Questions