views:

92

answers:

2

Hello. I am new to Xcode and iPhone SDK. I want to make a paging enabled horizontal scrolling. But I can't do that, only vertical scrolling.

A: 

Set the contentSize property of your UIScrollView properly (basically the width/height of the content that can be displayed in the scroll view without scrolling), set the pagingEnabled property of the scroll view to YES, and then add your view that you want to scroll as a subview of the UIScrollView. As long as the width of the subview is more than the width of the contentSize you specified, it should scroll horizontally.

macatomy
A: 

Add one UIScrollView for the paging, and add several UIScrollViews (maybe only three that you reuse) to the scrollView for the normal (vertical scrolling) content. Set the pagingEnabled property to YES on the paging scroll view. If you have access to the WWDC videos on Apple's site, there is a good video on that topic (session 104).

Eiko
You mean "and add several **UIViews**" I presume -- they shouldn't all be scroll views.
Kalle
Well, in Apple's example they indeed use UIScrollViews inside UIScrollViews to build something like the Photos app... which I think is similar to Sania's request.
Eiko