开发者

How can I scroll through multiple views?

I have multiple views as subclasses of开发者_如何学Go a UIScrollView. I would like to be able to horizontally scroll through those views using page control. What is the best way to do that?

Thanks!


You don't need for your views to be subclasses of UIScrollView. UIScrollView is a container that allows scrolling of its contents.

Add all your views as subviews to a single UIScrollView. Adjust the contentSize property of the scroll view to be large enough to hold all of your views. Then just add the scrollview to your main view. Take a look at the documentation of the UIScrollView and make sure that you have all of the features enabled that you want. (such as scrolling).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜