开发者

iPhone, How to enable horizontal scrolling

I am new to Xcode and iPhone SDK. I want to make a paging enabled horizontal scrolling. But I can't do开发者_JAVA百科 that, only vertical scrolling.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜