KHAN
KHAN

Reputation: 11

Manually Paging in uiscrollview

I have a scrollview with lets say ten subviews in it. All are shown at the same time. I want to page between each subview.

One idea is to set the frame size equal to a single subview and turn the paging on. But then it will receive the touch only within that frame. I want the user should be able to scroll it from any where in that scrollview.

For Example:

| sub1 sub2 sub3 sub4 sub5 sub6 sub7 sub8 sub9 sub10 |

I want the user to scroll it from any where in this scrollview, and page between these subviews.

Any Idea?

Upvotes: 1

Views: 902

Answers (2)

Dan Hanly
Dan Hanly

Reputation: 7839

make a frame that is the size of the subviews (frame) and then set these:

scrollview.pagingEnables = YES;
scrollview.contentSize = CGSizeMake(frame.size.width*numberofsubviews,  frame.size.height);

The UIScrollView should handle everything else from there on out.

The link that Toro sent you will help a great deal, I wouldn't avoid that if I were you

This link will help as well PhotoScroller

Upvotes: 0

AechoLiu
AechoLiu

Reputation: 18428

I think what you want is this.

Upvotes: 2

Related Questions